import type { DataStore } from '../types/data-store.js';
import type { GenericMessage } from '../types/message-types.js';
import type { MessageStore } from '../types/message-store.js';
import type { ProgressToken } from '../types/subscriptions.js';
import type { RecordsDeleteMessage, RecordsWriteMessage } from '../types/records-types.js';
export type ResumableRecordsDeleteData = {
    tenant: string;
    message: RecordsDeleteMessage;
};
export type ResumableRecordsSquashData = {
    tenant: string;
    message: RecordsWriteMessage;
};
export type RecordsDeleteTaskResult = {
    position?: ProgressToken;
};
/**
 * A class that provides an abstraction for coordinated MessageStore and DataStore mutations.
 */
export declare class StorageController {
    private readonly messageStore;
    private readonly dataStore;
    constructor({ messageStore, dataStore }: {
        messageStore: MessageStore;
        dataStore: DataStore;
    });
    performRecordsDelete({ tenant, message }: ResumableRecordsDeleteData): Promise<RecordsDeleteTaskResult>;
    /**
     * Performs the squash processing for a `RecordsWrite` with `squash: true`.
     * Deletes all sibling records at the same protocol path and parent context whose
     * `messageTimestamp` is strictly older than the squash record's `messageTimestamp`.
     * Unlike normal `RecordsDelete` tombstones, squash targets are fully purged — no initial writes
     * are retained.
     *
     * This method is idempotent — it can be safely re-run on resume after a crash.
     */
    performRecordsSquash({ tenant, message }: ResumableRecordsSquashData): Promise<void>;
    /**
     * Deletes the data referenced by the given message if needed.
     * @param message The message to check if the data it references should be deleted.
     */
    private static deleteFromDataStoreIfNeeded;
    /**
     * Purges (permanent hard-delete) all descendants of the given `recordId`, recursively.
     *
     * The cascade is intentionally protocol-agnostic: `parentContextId` is a structural link,
     * so pruning a parent removes every record hanging off it regardless of which protocol a
     * descendant lives in. Cross-protocol composing children (records in a different protocol
     * that reference the parent via `$ref` / `uses`) are included in the cascade.
     *
     * Rationale (closes #298 as working-as-intended):
     * - A DWN is tenant-owned storage. The tenant's prune authority extends across the whole
     *   subtree they rooted, regardless of which protocol a descendant declares itself under.
     * - Preserving cross-protocol orphans creates a half-alive state (readable but not
     *   updatable, since `validateReferentialIntegrity` requires the pruned parent) that is
     *   worse for callers than simply cascading.
     * - Same-protocol cascade is already protocol-agnostic at every hop via `parentId`,
     *   so treating cross-protocol boundaries differently was inconsistent.
     */
    static purgeRecordDescendants(tenant: string, recordId: string, messageStore: MessageStore, dataStore: DataStore): Promise<void>;
    /**
     * Purges (permanent hard-delete) all messages of the SAME `recordId` given and their associated data and events.
     * Assumes that the given `recordMessages` are all of the same `recordId`.
     */
    static purgeRecordMessages(tenant: string, recordMessages: GenericMessage[], messageStore: MessageStore, dataStore: DataStore): Promise<void>;
    /**
     * Deletes all messages in `existingMessages` that the `retainedMessage` displaces, while keeping
     * the initial write and the caller-supplied writes as non-latest state for future replay and
     * tombstone visibility reconstruction. Displacement is deliberately NOT a timestamp comparison:
     * a RecordsDelete displaces even a newer RecordsWrite (delete-wins convergence), and on
     * resumable-task replay the retained message itself is back in `existingMessages` and must
     * survive — so membership is decided by CID.
     */
    static deleteDisplacedMessagesAndRetainWrites(tenant: string, existingMessages: GenericMessage[], retainedMessage: GenericMessage, messageStore: MessageStore, dataStore: DataStore, additionalRetainedRecordsWrites: RecordsWriteMessage[]): Promise<void>;
    private static stripInlineData;
}
//# sourceMappingURL=storage-controller.d.ts.map