Skip to content

Commit cee6486

Browse files
committed
Make it clear what arguments are expected in RTLM7, RTLM8 and improve phrasing in RTLM7*, RTLM8*, RTLM6d1a and RTLM6d1b
This uses phrasing initially added in 652daac commit in #343 PR. It makes sense to include those changes in this #333 PR to make the OBJECT sync sequence and related spec items more clear.
1 parent a5be152 commit cee6486

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

specifications/objects-features.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,30 +118,36 @@ Objects feature enables clients to store shared data as "objects" on a channel.
118118
- `(RTLM6c)` Set `data` to `ObjectState.map.entries`, or to an empty map if it does not exist
119119
- `(RTLM6d)` If `ObjectState.createOp` is present:
120120
- `(RTLM6d1)` For each key--@ObjectsMapEntry@ pair in `ObjectState.createOp.map.entries`:
121-
- `(RTLM6d1a)` If `ObjectsMapEntry.tombstone` is `false` or omitted, apply the `MAP_SET` operation to the specified key using `ObjectsMapEntry.timeserial` and `ObjectsMapEntry.data` per [RTLM7](#RTLM7)
122-
- `(RTLM6d1b)` If `ObjectsMapEntry.tombstone` is `true`, apply the `MAP_REMOVE` operation to the specified key using `ObjectsMapEntry.timeserial` per [RTLM8](#RTLM8)
121+
- `(RTLM6d1a)` If `ObjectsMapEntry.tombstone` is `false` or omitted, apply the `MAP_SET` operation to the current key as described in [RTLM7](#RTLM7), passing in `ObjectsMapEntry.data` and the current key as `ObjectsMapOp`, and `ObjectsMapEntry.timeserial` as `serial`
122+
- `(RTLM6d1b)` If `ObjectsMapEntry.tombstone` is `true`, apply the `MAP_REMOVE` operation to the current key as described in [RTLM8](#RTLM8), passing in the current key as `ObjectsMapOp`, and `ObjectsMapEntry.timeserial` as `serial`
123123
- `(RTLM6d2)` Set the private flag `createOperationIsMerged` to `true`
124124
- `(RTLM7)` `MAP_SET` operation for a key can be applied to a `LiveMap` in the following way:
125+
- `(RTLM7d)` Expects the following arguments:
126+
- `(RTLM7d1)` `ObjectsMapOp`
127+
- `(RTLM7d2)` `serial` string - operation's serial value
125128
- `(RTLM7a)` If an `ObjectsMapEntry` exists in the private `data` for the specified key:
126129
- `(RTLM7a1)` If the operation cannot be applied to the existing entry as per [RTLM9](#RTLM9), discard the operation without taking any action
127130
- `(RTLM7a2)` Otherwise, apply the operation to the existing entry:
128131
- `(RTLM7a2a)` Set `ObjectsMapEntry.data` to the `ObjectData` from the operation
129-
- `(RTLM7a2b)` Set `ObjectsMapEntry.timeserial` to the operation's serial
132+
- `(RTLM7a2b)` Set `ObjectsMapEntry.timeserial` to the provided `serial`
130133
- `(RTLM7a2c)` Set `ObjectsMapEntry.tombstone` to `false`
131134
- `(RTLM7b)` If an entry does not exist in the private `data` for the specified key:
132-
- `(RTLM7b1)` Create a new entry in `data` for the specified key with the provided `ObjectData` and the operation's serial
135+
- `(RTLM7b1)` Create a new `ObjectsMapEntry` in `data` for the specified key, with `ObjectsMapEntry.data` set to the provided `ObjectData` and `ObjectsMapEntry.timeserial` set to `serial`
133136
- `(RTLM7b2)` Set `ObjectsMapEntry.tombstone` for the new entry to `false`
134137
- `(RTLM7c)` If the operation has a non-empty `ObjectData.objectId` attribute:
135138
- `(RTLM7c1)` Create a zero-value `LiveObject` for this `ObjectData.objectId` in the internal `ObjectsPool` per [RTO6](#RTO6)
136139
- `(RTLM8)` `MAP_REMOVE` operation for a key can be applied to a `LiveMap` in the following way:
140+
- `(RTLM8c)` Expects the following arguments:
141+
- `(RTLM8c1)` `ObjectsMapOp`
142+
- `(RTLM8c2)` `serial` string - operation's serial value
137143
- `(RTLM8a)` If an `ObjectsMapEntry` exists in the private `data` for the specified key:
138144
- `(RTLM8a1)` If the operation cannot be applied to the existing entry as per [RTLM9](#RTLM9), discard the operation without taking any action
139145
- `(RTLM8a2)` Otherwise, apply the operation to the existing entry:
140146
- `(RTLM8a2a)` Set `ObjectsMapEntry.data` to undefined/null
141-
- `(RTLM8a2b)` Set `ObjectsMapEntry.timeserial` to the operation's serial
147+
- `(RTLM8a2b)` Set `ObjectsMapEntry.timeserial` to the provided `serial`
142148
- `(RTLM8a2c)` Set `ObjectsMapEntry.tombstone` to `true`
143149
- `(RTLM8b)` If an entry does not exist in the private `data` for the specified key:
144-
- `(RTLM8b1)` Create a new entry in `data` for the specified key, with `ObjectsMapEntry.data` set to undefined/null and the operation's serial
150+
- `(RTLM8b1)` Create a new `ObjectsMapEntry` in `data` for the specified key, with `ObjectsMapEntry.data` set to undefined/null and `ObjectsMapEntry.timeserial` set to the provided `serial`
145151
- `(RTLM8b2)` Set `ObjectsMapEntry.tombstone` for the new entry to `true`
146152
- `(RTLM9)` Whether a map operation can be applied to a map entry is determined as follows:
147153
- `(RTLM9a)` For a `LiveMap` with `semantics` set to `ObjectsMapSemantics.LWW` (Last-Write-Wins CRDT semantics), the operation must only be applied if its serial is strictly greater ("after") than the entry's serial when compared lexicographically

0 commit comments

Comments
 (0)