argia-migrator - v0.3.0
    Preparing search index...

    Interface MigrationOptions<M, F>

    interface MigrationOptions<M, F = unknown> {
        compareRate: number;
        from: Profile<M, F>;
        onEvent?: (event: MigrationEvent<M>) => void;
        phase: Phase;
        random?: () => number;
        redactText?: (text: string) => string;
        shadowWriteFailure: "throw" | "report";
        to: Profile<M, F>;
        writeOrder?: "sequential" | "parallel";
    }

    Type Parameters

    • M
    • F = unknown
    Index
    compareRate: number

    The fraction of queries in the compare phase that also query the other side, from 0 to 1. A compared query costs a second embedding call and a second store query, and waits for the slower of the two. 1 compares every query; pick lower when that doubles a bill or a latency budget you care about. Unused outside compare.

    from: Profile<M, F>

    The model and store you are moving away from.

    onEvent?: (event: MigrationEvent<M>) => void

    Receives failures that were reported rather than thrown, and the results of every compared query. A listener that throws, or returns a promise that rejects, is ignored; an async listener is not awaited. Defaults to no listener.

    phase: Phase

    Where to start. Usually from, unless you are restarting a process mid-migration.

    random?: () => number

    Source of randomness for compareRate, returning [0, 1). Defaults to Math.random.

    redactText?: (text: string) => string

    Applied to the query text before it is put in a compare or shadow_query_failed event, so a listener never sees raw user input. Return "" to drop it, or a hash to group repeats. If it throws, the event is not sent. Defaults to passing the text through unchanged.

    shadowWriteFailure: "throw" | "report"

    What a failed write or delete on the side not being read does. The side being read is written first, and its failure always throws without the other side being touched.

    throw rethrows the store's or model's error, so your ingestion retries and the two stores stay in step. report sends a shadow_write_failed event and lets the call succeed, so a broken new store cannot take down ingestion, at the cost of the new index missing those documents until you write them again.

    to: Profile<M, F>

    The model and store you are moving to.

    writeOrder?: "sequential" | "parallel"

    How a dual write or delete reaches the two sides. sequential (the default) writes the read side first and the other side only if that succeeded, so a dual write takes as long as both together. parallel starts both at once and takes as long as the slower one; a write the read side refused may then still land on the other side. That is harmless under the version contract, since the call throws and your retry rewrites the same version, but the shadow can briefly hold a copy the read side does not. Failures are handled the same way in both modes.