symfonic.memory.backends.postgres_working_guard¶
postgres_working_guard ¶
Explicit v0 PostgreSQL Working endpoint registration and retirement.
Only a host that already admitted an owner may call these operations. They require the host's transaction on the same pool as its graph backend; the database trigger also fences writers running older Python binaries.
WorkingEndpointGuard
dataclass
¶
Explicit host binding; never infer a guard schema from search_path.
install_working_endpoint_guard
async
¶
Install explicitly as an offline migration before Working admission.
This locks the graph tables against concurrent writes while checking that the reserved namespace is unused, then installs the triggers atomically. Rehearse the lock cost on staging; this is not a hot-rollout hook.
Source code in src/symfonic/memory/backends/postgres_working_guard.py
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | |
register_working_endpoint
async
¶
Register a newly created Working node in the same transaction.
Any preexisting incident edge, including a legacy orphan, prevents an old edge from silently becoming attached to this new Working identity.
Advisory contention refuses with SQLSTATE 23514 instead of waiting, even without a lock cycle. Roll back the host transaction before any retry.
Source code in src/symfonic/memory/backends/postgres_working_guard.py
retire_working_endpoint
async
¶
Tombstone, remove same-owner edges, then delete the node atomically.
A foreign-owned incident edge is a refusal, never an invitation to delete another scope's data. Tombstones remain so delayed legacy writes cannot recreate an incident edge after the node is gone.
Tenant or endpoint advisory contention refuses with SQLSTATE 23514 instead of waiting, even for unrelated retirements in the same tenant. Roll back the host transaction before any retry. This is a narrow advisory fence; unmanaged savepoints/caught errors and other row locks remain unresolved.