ReadonlycompareReadonlyfromThe model and store you are moving away from.
Optional ReadonlyonReceives 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.
ReadonlyphaseWhere to start. Usually from, unless you are restarting a process mid-migration.
Optional ReadonlyrandomSource of randomness for compareRate, returning [0, 1). Defaults to Math.random.
Optional ReadonlyredactApplied 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.
ReadonlyshadowWhat 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.
ReadonlytoThe model and store you are moving to.
Optional ReadonlywriteHow 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.
The fraction of queries in the
comparephase 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 outsidecompare.