Closed jsflax closed 5 years ago
Disregard that comment
On Thu 15 Nov 2018, 12:58 Jason Flax, notifications@github.com wrote:
@jsflax commented on this pull request.
In Core/Services/StitchCoreRemoteMongoDBService/Sources/StitchCoreRemoteMongoDBService/Sync/CoreDocumentSynchronizationConfig.swift https://github.com/mongodb/stitch-ios-sdk/pull/103#discussion_r233948518 :
- locally emitted change event. This variant maintains the last version set.
- parameter atTime: the time at which the write occurred.
- parameter changeEvent: the description of the write/change.
- */
- mutating func setSomePendingWrites(atTime: TimeInterval,
- changeEvent: ChangeEvent
) { - // if we were frozen
- if (isPaused) {
- // unfreeze the document due to the local write
- isPaused = false
- // and now the unfrozen document is now stale
- isStale = true
- }
- docLock.writeLock()
I ported over what happens on Android and assumed we had a reason for doing it this way. @edaniels https://github.com/edaniels?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mongodb/stitch-ios-sdk/pull/103#discussion_r233948518, or mute the thread https://github.com/notifications/unsubscribe-auth/AEJ7QEaXQkjHDJWTw8kICeszA-LbrNK9ks5uvasogaJpZM4YcyA1 .
@adamchel @dkaminsky I think we should kick the versioning changes downfield until we get to that ticket. I've laid down the base model which arguably was in scope for this one.
Otherwise, I've addressed your remarks. PTAL.
"Port" the following classes:
InstanceSynchronization:
InstanceSynchronization.Config
). This was due to the fact that the current Java equivalent can exist in a partial state, which is a no-go in Swift. It also cleans up a significant amount of the encoding/decoding code, which was cumbersome. IMO, we should make these changes on Java as well.Sequence
. Can iterate throughNamespaceSynchronization.Configs
.InstanceSynchronization
subscript uses a mutating getter to either get existingNamespaceSynchronization
s or will create new ones.NamespaceSynchronization
Sequence
. Can iterate throughCoreDocumentSynchronization.Configs
.NamespaceSynchronization
subscript will either fetch existingCoreDocumentSynchronization
byid
or can set new ones by id.CoreDocumentSynchronization
Config
properties are now private. The properties are exposed in the outlying structCoreDocumentSynchronization
as computed properties. These getters/setters are synchronized via aReadWriteLock
, with the setters mutating the underlyingconfig
.ChangeEvent
OperationType
has been moved out to its own enum.transform
(the method that converts a ChangeEvent with an associated type ofDocument
to a user associated type) now takes on a more Swifty shape.UpdateDescription
UpdateDescription
has been moved out to its own class.Document
is now computed lazily.diff
is now a method extended to theDocument
class.ConflictHandler
ChangeEventListener
MongoNamespace
MongoMobile
. Simple port-over.DocumentVersionInfo
nextVersionDocument
is now lazily computed.ReadWriteLock
pthread_rwlock_t
.Other additions, notable or otherwise: