/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
import { Brand, IdAllocator } from "../../util";
import { FieldKey } from "../schema-stored";
import * as Delta from "./delta";
/**
 * ID used to create a detached field key for a removed subtree.
 * @alpha
 *
 * TODO: Move to Forest once forests can support multiple roots.
 */
export type ForestRootId = Brand<number, "tree.ForestRootId">;
type Major = string | number | undefined;
/**
 * The tree index records detached field IDs and associates them with a change atom ID.
 */
export declare class DetachedFieldIndex {
    private readonly name;
    private rootIdAllocator;
    private detachedNodeToField;
    /**
     * @param name - A name for the index, used as a prefix for the generated field keys.
     * @param rootIdAllocator - An ID allocator used to generate unique field keys.
     */
    constructor(name: string, rootIdAllocator: IdAllocator<ForestRootId>);
    clone(): DetachedFieldIndex;
    entries(): Generator<{
        root: ForestRootId;
    } & {
        id: Delta.DetachedNodeId;
    }>;
    updateMajor(current: Major, updated: Major): void;
    /**
     * Returns a field key for the given ID.
     * This does not save the field key on the index. To do so, call {@link createEntry}.
     */
    toFieldKey(id: ForestRootId): FieldKey;
    /**
     * Returns the FieldKey associated with the given id.
     * Returns undefined if no such id is known to the index.
     */
    tryGetEntry(id: Delta.DetachedNodeId): ForestRootId | undefined;
    /**
     * Returns the FieldKey associated with the given id.
     * Fails if no such id is known to the index.
     */
    getEntry(id: Delta.DetachedNodeId): ForestRootId;
    deleteEntry(nodeId: Delta.DetachedNodeId): void;
    /**
     * Associates the DetachedNodeId with a field key and creates an entry for it in the index.
     */
    createEntry(nodeId?: Delta.DetachedNodeId, count?: number): ForestRootId;
    encode(): string;
    /**
     * Loads the tree index from the given string, this overrides any existing data.
     */
    loadData(data: string): void;
}
export {};
//# sourceMappingURL=detachedFieldIndex.d.ts.map