/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
import { IDocumentStorageService, ISnapshotTree, ISequencedDocumentMessage } from "@fluidframework/driver-definitions/internal";
import { ISummaryTreeWithStats } from "@fluidframework/runtime-definitions/internal";
import { IGCMetadata } from "../gc/index.js";
import { IDocumentSchema } from "./documentSchema.js";
/**
 * @deprecated - This interface will no longer be exported in the future(AB#8004).
 * @alpha
 */
export type OmitAttributesVersions<T> = Omit<T, "snapshotFormatVersion" | "summaryFormatVersion">;
/**
 * @deprecated - This interface will no longer be exported in the future(AB#8004).
 * @alpha
 */
export interface IFluidDataStoreAttributes0 {
    readonly snapshotFormatVersion?: undefined;
    readonly summaryFormatVersion?: undefined;
    pkg: string;
    /**
     * This tells whether a data store is root. Root data stores are never collected.
     * Non-root data stores may be collected if they are not used. If this is not present, default it to
     * true. This will ensure that older data stores are incorrectly collected.
     */
    readonly isRootDataStore?: boolean;
}
/**
 * @deprecated - This interface will no longer be exported in the future(AB#8004).
 * @alpha
 */
export interface IFluidDataStoreAttributes1 extends OmitAttributesVersions<IFluidDataStoreAttributes0> {
    readonly snapshotFormatVersion: "0.1";
    readonly summaryFormatVersion?: undefined;
}
/**
 * @deprecated - This interface will no longer be exported in the future(AB#8004).
 * @alpha
 */
export interface IFluidDataStoreAttributes2 extends OmitAttributesVersions<IFluidDataStoreAttributes1> {
    /** Switch from snapshotFormatVersion to summaryFormatVersion */
    readonly snapshotFormatVersion?: undefined;
    readonly summaryFormatVersion: 2;
    /**
     * True if channels are not isolated in .channels subtrees, otherwise isolated.
     * This is required in both datastore attributes as well as the root container,
     * because reused summary handles may cause different format versions in each
     * datastore subtree within the summary.
     */
    readonly disableIsolatedChannels?: true;
}
/**
 * Added IFluidDataStoreAttributes similar to IChannelAttributes which will tell the attributes of a
 * store like the package, snapshotFormatVersion to take different decisions based on a particular
 * snapshotFormatVersion.
 *
 * @deprecated - This interface will no longer be exported in the future(AB#8004).
 *
 * @alpha
 *
 */
export type ReadFluidDataStoreAttributes = IFluidDataStoreAttributes0 | IFluidDataStoreAttributes1 | IFluidDataStoreAttributes2;
export type WriteFluidDataStoreAttributes = IFluidDataStoreAttributes1 | IFluidDataStoreAttributes2;
export declare function getAttributesFormatVersion(attributes: ReadFluidDataStoreAttributes): number;
export declare function hasIsolatedChannels(attributes: ReadFluidDataStoreAttributes): boolean;
/**
 * @alpha
 */
export interface IContainerRuntimeMetadata extends ICreateContainerMetadata, IGCMetadata {
    readonly summaryFormatVersion: 1;
    /** @deprecated - used by old (prior to 2.0 RC3) runtimes */
    readonly message?: ISummaryMetadataMessage;
    /** The last message processed at the time of summary. Only primitive property types are added to the summary. */
    readonly lastMessage?: ISummaryMetadataMessage;
    /** True if channels are not isolated in .channels subtrees, otherwise isolated. */
    readonly disableIsolatedChannels?: true;
    /** The summary number for a container's summary. Incremented on summaries throughout its lifetime. */
    readonly summaryNumber?: number;
    /** GUID to identify a document in telemetry */
    readonly telemetryDocumentId?: string;
    readonly documentSchema?: IDocumentSchema;
}
/**
 * @alpha
 */
export interface ICreateContainerMetadata {
    /** Runtime version of the container when it was first created */
    createContainerRuntimeVersion?: string;
    /** Timestamp of the container when it was first created */
    createContainerTimestamp?: number;
}
/**
 * The properties of an ISequencedDocumentMessage to be stored in the metadata blob in summary.
 * @alpha
 */
export type ISummaryMetadataMessage = Pick<ISequencedDocumentMessage, "clientId" | "clientSequenceNumber" | "minimumSequenceNumber" | "referenceSequenceNumber" | "sequenceNumber" | "timestamp" | "type">;
/**
 * Extracts the properties from an ISequencedDocumentMessage as defined by ISummaryMetadataMessage. This message is
 * added to the metadata blob in summary.
 */
export declare const extractSummaryMetadataMessage: (message?: ISequencedDocumentMessage) => ISummaryMetadataMessage | undefined;
export declare function getMetadataFormatVersion(metadata?: IContainerRuntimeMetadata): number;
export declare const aliasBlobName = ".aliases";
export declare const metadataBlobName = ".metadata";
export declare const chunksBlobName = ".chunks";
export declare const electedSummarizerBlobName = ".electedSummarizer";
export declare const blobsTreeName = ".blobs";
export declare const idCompressorBlobName = ".idCompressor";
export declare const blobHeadersBlobName = ".metadata.blobHeaders";
export declare function rootHasIsolatedChannels(metadata?: IContainerRuntimeMetadata): boolean;
export declare const protocolTreeName = ".protocol";
/**
 * List of tree IDs at the container level which are reserved.
 * This is for older versions of summaries that do not yet have an
 * isolated data stores namespace. Without the namespace, this must
 * be used to prevent name collisions with data store IDs.
 */
export declare const nonDataStorePaths: string[];
export declare const dataStoreAttributesBlobName = ".component";
/**
 * Modifies summary tree and stats to put tree under .channels tree.
 *
 * @param summarizeResult - Summary tree and stats to modify
 *
 * @example
 *
 * Converts from:
 *
 * ```typescript
 * {
 *     type: SummaryType.Tree,
 *     tree: { a: {...}, b: {...}, c: {...} },
 * }
 * ```
 *
 * to:
 *
 * ```typescript
 * {
 *     type: SummaryType.Tree,
 *     tree: {
 *         ".channels": {
 *             type: SummaryType.Tree,
 *             tree: { a: {...}, b: {...}, c: {...} }
 *         },
 *     },
 * }
 * ```
 *
 * And adds +1 to treeNodeCount in stats.
 */
export declare function wrapSummaryInChannelsTree(summarizeResult: ISummaryTreeWithStats): void;
export declare function getFluidDataStoreAttributes(storage: IDocumentStorageService, snapshot: ISnapshotTree): Promise<ReadFluidDataStoreAttributes>;
//# sourceMappingURL=summaryFormat.d.ts.map