Version: latest
agrag.ingestion.merge.apply_merge
apply_merge(plan:MergePlan, *, graph_store:GraphStore, schema:GraphSchema, pending_job_id:str | None = None, deferred:DeferredWrites | None = None) -> None
Write a computed MergePlan to storage.
Every call runs inside one GraphStore transaction. It upserts the survivor and records a merge-key alias for its current name. A failure partway through leaves no half-written state. No survivor without its alias remains.
Parameters:
- plan (
MergePlan) – The merge to write. - graph_store (
GraphStore) – Where the merge is written. - schema (
GraphSchema) – The schema the survivor's label belongs to. Its hierarchy decides the ancestor labels the node is stored with. - pending_job_id (
str | None) – The in-flight Cutover Job's id, tagging the survivor node and its aliases until that job commits. It also fences the alias and survivor writes, so they run only while the job is pending with a live lease. None writes untagged and unfenced, for callers outside a job. - deferred (
DeferredWrites | None) – Receives the survivor write when it reaches a committed entity. Required whenpending_job_idis set.
Raises:
ValueError–pending_job_idis set anddeferredis None.GraphStoreAliasConflictError– An accepted merge_key is already owned by a live entity outside this merge's own survivor id -- a concurrent writer accepted that name as an alias of, or created it as the canonical name of, a different entity.GraphStoreFenceError–pending_job_idis set and the job is no longer pending with a live lease.