Commit 32e2351
Add placeholder RTLO3f for parentReferences
Stubs out the new `parentReferences` internal property on
`LiveObject`, needed by `getFullPaths` (RTLO4f). The detailed
maintenance rules (across `MAP_SET`, `MAP_REMOVE`, `MAP_CLEAR`,
`LiveMap` tombstoning, and post-sync rebuild) are deferred to a
follow-up by Sachin; the in-progress draft is at [1].
ably-js stores `parentReferences` as a map keyed by a direct
`LiveMap` reference; the placeholder instead keys by `objectId`,
for consistency with how the rest of the LiveObjects spec models
inter-object references (forward references in `LiveMap` entries
are already objectIds resolved via the `ObjectsPool` on demand).
This is also load-bearing for languages without automatic cycle
collection. The protocol allows cyclic `LiveMap` graphs (e.g.
`A.x = B`, `B.y = A`), and `getFullPaths` is being specified to
handle them; under ARC in Swift, direct parent references in such
a cycle would form an unbreakable retain cycle on the two
`LiveMap`s. Keying by `objectId` lets the `ObjectsPool` remain the
single owner and sidesteps the issue.
Implementations remain explicitly permitted to store a direct
`LiveMap` reference if more idiomatic in their language -- e.g.
to avoid an `ObjectsPool` lookup at each `getFullPaths` traversal
step -- as ably-js does today, provided they handle the cycle
concern.
[1] #480
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 294b7b1 commit 32e2351
1 file changed
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
323 | 323 | | |
324 | 324 | | |
325 | 325 | | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
326 | 329 | | |
327 | 330 | | |
328 | 331 | | |
| |||
1080 | 1083 | | |
1081 | 1084 | | |
1082 | 1085 | | |
| 1086 | + | |
1083 | 1087 | | |
1084 | 1088 | | |
1085 | 1089 | | |
| |||
0 commit comments