/**
 * Orchestrates building, persisting, and loading a MaterializedView
 * composed of a LogicalIndex + PropertyIndexReader.
 *
 * Five entry points:
 * - `build(state)` — from a WarpState (in-memory)
 * - `persistIndexTree(tree, persistence)` — write shards to Git storage
 * - `loadFromOids(shardOids, storage)` — hydrate from blob OIDs
 * - `applyDiff(existingTree, diff, state)` — incremental update from PatchDiff
 * - `verifyIndex({ state, logicalIndex, options })` — cross-provider verification
 *
 * @module domain/services/MaterializedViewService
 */
import PropertyIndexReader from './index/PropertyIndexReader.ts';
import { type VerifyResult, type VerifyIndexParams } from './MaterializedViewVerifier.ts';
import type CodecPort from '../../ports/CodecPort.ts';
import type LoggerPort from '../../ports/LoggerPort.ts';
import type IndexStorePort from '../../ports/IndexStorePort.ts';
import type WarpState from './state/WarpState.ts';
import type { PatchDiff } from '../types/PatchDiff.ts';
import type { LogicalIndex } from './index/logicalIndexHelpers.ts';
export type { VerifyResult, VerifyError } from './MaterializedViewVerifier.ts';
export interface BuildResult {
    tree: Record<string, Uint8Array>;
    logicalIndex: LogicalIndex;
    propertyReader: PropertyIndexReader;
    receipt: Record<string, unknown>;
}
export interface LoadResult {
    logicalIndex: LogicalIndex;
    propertyReader: PropertyIndexReader;
}
export interface MaterializedViewServiceOptions {
    codec?: CodecPort;
    logger?: LoggerPort;
    indexStore?: IndexStorePort;
}
export default class MaterializedViewService {
    private readonly _codec;
    private readonly _indexStore;
    constructor(options?: MaterializedViewServiceOptions);
    /**
     * Builds a complete MaterializedView from WarpState.
     */
    build(state: WarpState): BuildResult;
    /**
     * Writes each shard as a blob and creates a Git tree object.
     *
     * @returns tree OID
     */
    persistIndexTree(tree: Record<string, Uint8Array>, persistence: {
        writeBlob(buf: Uint8Array): Promise<string>;
        writeTree(entries: string[]): Promise<string>;
    }): Promise<string>;
    /**
     * Hydrates a LogicalIndex + PropertyIndexReader from blob OIDs.
     *
     * @param shardOids - path to blob OID
     * @param storage - blob storage backend
     */
    loadFromOids(shardOids: Record<string, string>, storage: {
        readBlob(oid: string): Promise<Uint8Array>;
    }): Promise<LoadResult>;
    /**
     * Applies a PatchDiff incrementally to an existing index tree.
     */
    applyDiff(params: {
        existingTree: Record<string, Uint8Array>;
        diff: PatchDiff;
        state: WarpState;
    }): BuildResult;
    /**
     * Verifies index integrity by sampling alive nodes and comparing
     * bitmap neighbor queries against adjacency-based ground truth.
     */
    verifyIndex(params: VerifyIndexParams): VerifyResult;
    /**
     * Encodes IndexShard instances to a tree of CBOR bytes.
     *
     * P5-LEGACY: This exists to support callers that persist via
     * persistIndexTree(tree, persistence). Will be removed when callers
     * migrate to IndexStorePort.writeShards().
     */
    private _encodeShardsToTree;
}
