Conflict resolution for element updates #17
Labels
No labels
Kind/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
crate/ubisync
crate/ubisync-lib
crate/ubisync-sdk
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
philip/ubisync#17
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This is a major feature and very complex. Some thoughts:
Elementcould have exactly one permanent assigned strategy. Changing the strategy would require creating a new element and either recreating the change history or just using the latest "snapshot" (whatever "latest" may mean in that sense). The strategy would be stored in a member variable ofElement.It should be possible for an app to handle conflict resolution itself, because there may be very domain-specific ways to handle it. In that case, the
ContentUpdateStrategyis basically a no-op, passing the message on to the app.ElementContentvariants there may be better strategies which are always applicable. There should be a way to map anyElementContentto its default optimal strategy, in case the app does not specify one, to avoid sub-optimal inconsistent overwrite wherever possible.ElementContentSome strategies (like basic "just overwrite") are compatible with everyElementContent, some others (which e.g. respect particular JSON fields in the content or perform computation on the content) require a certain structure of the content.In the end, any deviation (like a modifying party not adhering to the selected strategy, a creating party selecting a strategy which is not compatible with the
ElementContent, etc.) will lead to runtime errors and ultimately ignoring an update/create event anyways. So enforcing compatibility by e.g. implementingElementContentas a trait, concrete content types as structs implementing this trait, and strategies as traits which are only implemented for some of the content stucts may not make much sense considering the additional complexity introduced by such a step.ubisync-libis supposed to define all necessary standards so arbitrary nodes can still be interoperable, whileubisyncprovides one possible implementation of a ubisync node. Thus, the definition ofElementcould be changed where it currently is, and an enumContentUpdateStrategycontaining identifiers of all supported strategies would also be put insideubisync-lib.The concrete implementation of conflict resolution must however be done in
ubisync, since it may be tightly coupled with specific properties of the node implementation (like using the selected database efficiently, platform-specific factors, and much more). TheElement'sContentUpdateStrategyis deserialized after receiving a message, and based on the value of this field the node starts processing the message as necessary.To break up complexity, the implementation could be divided into the following parts:
ElementandContentUpdateStrategy(including a default Overwrite variant), renameSetElementmessage toUpdateElement#12ElementCreateRequestto allow apps to choose the appropriateContentUpdateStrategy(as an option) #13ElementContentwhich maps a content object to its default suggested strategy #15UpdateElementmessage, match onContentUpdateStrategyto enable future expansion to other conflict resolution strategies #14Overwritestrategy #16