/**
 * Index edge operations for incremental bitmap index updates.
 *
 * Handles edge add/remove against mutable EdgeShardData caches,
 * managing per-label and "all" bucket bitmaps. Stateless — all
 * state is owned by the IncrementalIndexUpdater orchestrator.
 *
 * @module domain/services/index/IndexEdgeUpdater
 */
import { type RoaringBitmapSubset } from '../../utils/roaring.ts';
import type { WorkingMetaShard, EdgeShardData } from './types.ts';
import type { EdgeDiffEntry } from '../../types/PatchDiff.ts';
/** Shared context passed from the orchestrator to edge operations. */
export type EdgeUpdateContext = {
    readonly labels: Record<string, number>;
    readonly getOrLoadMeta: (shardKey: string) => WorkingMetaShard;
    readonly fwdCache: Map<string, EdgeShardData>;
    readonly revCache: Map<string, EdgeShardData>;
    readonly getOrLoadEdgeShard: (cache: Map<string, EdgeShardData>, dir: string, shardKey: string) => EdgeShardData;
};
/**
 * Handles edge-level index mutations: add, remove, bitmap maintenance.
 */
export default class IndexEdgeUpdater {
    /**
     * Adds forward and reverse bitmap entries for a new edge.
     *
     * Both "all" and per-label buckets are updated in the forward
     * shard (keyed by `from`) and reverse shard (keyed by `to`).
     */
    handleEdgeAdd(edge: EdgeDiffEntry, ctx: EdgeUpdateContext): void;
    /**
     * Removes forward and reverse bitmap entries for a deleted edge.
     *
     * Removes from the per-label bucket, then recomputes the "all"
     * bucket by OR-ing remaining per-label bitmaps.
     */
    handleEdgeRemove(edge: EdgeDiffEntry, ctx: EdgeUpdateContext): void;
    /**
     * Deserializes a bitmap from edge shard data, or creates a new one.
     */
    deserializeBitmap(data: EdgeShardData, bucket: string, ownerStr: string): RoaringBitmapSubset;
    /**
     * Adds a target globalId to an edge bitmap entry for the given owner.
     */
    private _addToEdgeBitmap;
    /**
     * Removes a target globalId from an edge bitmap entry for the given owner.
     */
    private _removeFromEdgeBitmap;
    /**
     * Recomputes the "all" bucket for a given owner by OR-ing all per-label bitmaps.
     */
    private _recomputeAllBucket;
}
