@@ -177,7 +177,7 @@ internal struct ObjectsPool {
177177
178178 /// Applies the objects gathered during an `OBJECT_SYNC` to this `ObjectsPool`, per RTO5c1 and RTO5c2.
179179 internal mutating func applySyncObjectsPool(
180- _ syncObjectsPool: [ ObjectState ] ,
180+ _ syncObjectsPool: [ SyncObjectsPoolEntry ] ,
181181 logger: AblyPlugin . Logger ,
182182 userCallbackQueue: DispatchQueue ,
183183 clock: SimpleClock ,
@@ -191,46 +191,46 @@ internal struct ObjectsPool {
191191 var updatesToExistingObjects : [ ObjectsPool . Entry . DeferredUpdate ] = [ ]
192192
193193 // RTO5c1: For each ObjectState member in the SyncObjectsPool list
194- for objectState in syncObjectsPool {
195- receivedObjectIds. insert ( objectState . objectId)
194+ for syncObjectsPoolEntry in syncObjectsPool {
195+ receivedObjectIds. insert ( syncObjectsPoolEntry . state . objectId)
196196
197197 // RTO5c1a: If an object with ObjectState.objectId exists in the internal ObjectsPool
198- if let existingEntry = entries [ objectState . objectId] {
199- logger. log ( " Updating existing object with ID: \( objectState . objectId) " , level: . debug)
198+ if let existingEntry = entries [ syncObjectsPoolEntry . state . objectId] {
199+ logger. log ( " Updating existing object with ID: \( syncObjectsPoolEntry . state . objectId) " , level: . debug)
200200
201201 // RTO5c1a1: Override the internal data for the object as per RTLC6, RTLM6
202- let deferredUpdate = existingEntry. replaceData ( using: objectState , objectsPool: & self )
202+ let deferredUpdate = existingEntry. replaceData ( using: syncObjectsPoolEntry . state , objectsPool: & self )
203203 // RTO5c1a2: Store this update to emit at end
204204 updatesToExistingObjects. append ( deferredUpdate)
205205 } else {
206206 // RTO5c1b: If an object with ObjectState.objectId does not exist in the internal ObjectsPool
207- logger. log ( " Creating new object with ID: \( objectState . objectId) " , level: . debug)
207+ logger. log ( " Creating new object with ID: \( syncObjectsPoolEntry . state . objectId) " , level: . debug)
208208
209209 // RTO5c1b1: Create a new LiveObject using the data from ObjectState and add it to the internal ObjectsPool:
210210 let newEntry : Entry ?
211211
212- if objectState . counter != nil {
212+ if syncObjectsPoolEntry . state . counter != nil {
213213 // RTO5c1b1a: If ObjectState.counter is present, create a zero-value LiveCounter,
214214 // set its private objectId equal to ObjectState.objectId and override its internal data per RTLC6
215- let counter = InternalDefaultLiveCounter . createZeroValued ( objectID: objectState . objectId, logger: logger, userCallbackQueue: userCallbackQueue, clock: clock)
216- _ = counter. replaceData ( using: objectState )
215+ let counter = InternalDefaultLiveCounter . createZeroValued ( objectID: syncObjectsPoolEntry . state . objectId, logger: logger, userCallbackQueue: userCallbackQueue, clock: clock)
216+ _ = counter. replaceData ( using: syncObjectsPoolEntry . state )
217217 newEntry = . counter( counter)
218- } else if let objectsMap = objectState . map {
218+ } else if let objectsMap = syncObjectsPoolEntry . state . map {
219219 // RTO5c1b1b: If ObjectState.map is present, create a zero-value LiveMap,
220220 // set its private objectId equal to ObjectState.objectId, set its private semantics
221221 // equal to ObjectState.map.semantics and override its internal data per RTLM6
222- let map = InternalDefaultLiveMap . createZeroValued ( objectID: objectState . objectId, semantics: objectsMap. semantics, logger: logger, userCallbackQueue: userCallbackQueue, clock: clock)
223- _ = map. replaceData ( using: objectState , objectsPool: & self )
222+ let map = InternalDefaultLiveMap . createZeroValued ( objectID: syncObjectsPoolEntry . state . objectId, semantics: objectsMap. semantics, logger: logger, userCallbackQueue: userCallbackQueue, clock: clock)
223+ _ = map. replaceData ( using: syncObjectsPoolEntry . state , objectsPool: & self )
224224 newEntry = . map( map)
225225 } else {
226226 // RTO5c1b1c: Otherwise, log a warning that an unsupported object state message has been received, and discard the current ObjectState without taking any action
227- logger. log ( " Unsupported object state message received for objectId: \( objectState . objectId) " , level: . warn)
227+ logger. log ( " Unsupported object state message received for objectId: \( syncObjectsPoolEntry . state . objectId) " , level: . warn)
228228 newEntry = nil
229229 }
230230
231231 if let newEntry {
232232 // Note that we will never replace the root object here, and thus never break the RTO3b invariant that the root object is always a map. This is because the pool always contains a root object and thus we always go through the RTO5c1a branch of the `if` above.
233- entries [ objectState . objectId] = newEntry
233+ entries [ syncObjectsPoolEntry . state . objectId] = newEntry
234234 }
235235 }
236236 }
0 commit comments