import type { Bytes, BytesReference, MetadataMapping, StorageLoader, StorageSaver } from "./types";
export type ForkMapping = {
    [key: number]: MantarayFork;
};
export declare class MantarayFork {
    prefix: Uint8Array;
    node: MantarayNode;
    /**
     * @param prefix the non-branching part of the subpath
     * @param node in memory structure that represents the Node
     */
    constructor(prefix: Uint8Array, node: MantarayNode);
    private createMetadataPadding;
    serialize(): Uint8Array;
    static deserialize(data: Uint8Array, obfuscationKey: Bytes<32>, options?: {
        withMetadata?: {
            refBytesSize: number;
            metadataByteSize: number;
        };
    }): MantarayFork;
}
export declare class MantarayNode {
    /** Used with NodeType type */
    private _type?;
    private _obfuscationKey?;
    /** reference of a loaded manifest node. if undefined, the node can be handled as `dirty` */
    private _contentAddress?;
    /** reference of an content that the manifest refers to */
    private _entry?;
    private _metadata?;
    /** Forks of the manifest. Has to be initialized with `{}` on load even if there were no forks */
    forks?: ForkMapping;
    get contentAddress(): BytesReference | undefined;
    set contentAddress(contentAddress: BytesReference);
    get entry(): BytesReference | undefined;
    set entry(entry: BytesReference);
    get type(): number;
    set type(type: number);
    get obfuscationKey(): Bytes<32> | undefined;
    set obfuscationKey(obfuscationKey: Bytes<32>);
    get metadata(): MetadataMapping | undefined;
    set metadata(metadata: MetadataMapping);
    get readable(): object;
    isValueType(): boolean;
    isEdgeType(): boolean;
    isWithPathSeparatorType(): boolean;
    IsWithMetadataType(): boolean;
    private makeValue;
    private makeEdge;
    private makeWithPathSeparator;
    private makeWithMetadata;
    private makeNotWithPathSeparator;
    private updateWithPathSeparator;
    /**
     *
     * @param path path sting represented in bytes. can be 0 length, then `entry` will be the current node's entry
     * @param entry
     * @param metadata
     * @param storage
     */
    addFork(path: Uint8Array, entry: BytesReference, metadata?: MetadataMapping): void;
    /**
     * Gives back a MantarayFork under the given path
     *
     * @param path valid path within the MantarayNode
     * @returns MantarayFork with the last unique prefix and its node
     * @throws error if there is no node under the given path
     */
    getForkAtPath(path: Uint8Array): MantarayFork;
    /**
     * Check if node exists under the given path
     *
     * @param path valid path within the MantarayNode
     * @returns True if exists, false otherwise
     */
    hasForkAtPath(path: Uint8Array): boolean;
    /**
     * Get all forks with a path prefix
     * @param prefix path prefix
     * @returns List of forks
     */
    getNodesWithPrefix(prefix: Uint8Array): MantarayNode[];
    /**
     * Removes a path from the node
     *
     * @param path Uint8Array of the path of the node intended to remove
     */
    removePath(path: Uint8Array): void;
    load(storageLoader: StorageLoader, reference: BytesReference): Promise<void>;
    /**
     * Saves dirty flagged ManifestNodes and its forks recursively
     * @returns Reference of the top manifest node.
     */
    save(storageSaver: StorageSaver): Promise<BytesReference>;
    isDirty(): boolean;
    makeDirty(): void;
    serialize(): Uint8Array;
    deserialize(data: Uint8Array): void;
    private recursiveLoad;
    private recursiveSave;
}
/** Checks for separator character in the node and its descendants prefixes */
export declare function checkForSeparator(node: MantarayNode): boolean;
/** loads all nodes recursively */
export declare function loadAllNodes(storageLoader: StorageLoader, node: MantarayNode): Promise<void>;
/**
 * Throws an error if the given nodes properties are not equal
 *
 * @param a Mantaray node to compare
 * @param b Mantaray node to compare
 * @param accumulatedPrefix accumulates the prefix during the recursion
 * @throws Error if the two nodes properties are not equal recursively
 */
export declare const equalNodes: (a: MantarayNode, b: MantarayNode, accumulatedPrefix?: string) => void | never;
//# sourceMappingURL=index.d.ts.map