Commit 6b90282
committed
sdk: Fix
Previously, `get_identifiable_by_couchdb_id()` called `update_from()`
on the cached object when the same id was already in the
`WeakValueDictionary`, silently discarding any in-memory mutations.
`get_item()` had no cache-hit check and always went to the network.
`commit()` was never implemented despite the `_revision_store`
infrastructure already existing.
The fix mirrors the changes made to `LocalFileIdentifiableStore`:
- `get_identifiable_by_couchdb_id()`: return the cached instance on a
hit (preserving mutations) without calling `update_from()`; the
`_rev` from the GET response is still stored so future `commit()`
calls use the correct revision.
- `get_item()`: check the cache first and return immediately on a hit
to avoid an unnecessary network round-trip.
- Add `commit()`: PUT the serialized object with the stored `_rev`,
update `_revision_store` with the new revision on success, and
surface 409 Conflict as `CouchDBConflictError`.CouchDBIdentifiableStore mutation persistence1 parent 846f805 commit 6b90282
1 file changed
Lines changed: 36 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
163 | | - | |
164 | 163 | | |
165 | 164 | | |
166 | 165 | | |
167 | 166 | | |
168 | 167 | | |
169 | 168 | | |
170 | 169 | | |
171 | | - | |
172 | | - | |
173 | 170 | | |
174 | 171 | | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
| 172 | + | |
| 173 | + | |
179 | 174 | | |
180 | 175 | | |
181 | 176 | | |
| |||
186 | 181 | | |
187 | 182 | | |
188 | 183 | | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
189 | 187 | | |
190 | 188 | | |
191 | 189 | | |
| |||
220 | 218 | | |
221 | 219 | | |
222 | 220 | | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
223 | 252 | | |
224 | 253 | | |
225 | 254 | | |
| |||
0 commit comments