-
Notifications
You must be signed in to change notification settings - Fork 1
Optimistic Concurrency Pt.2 #841
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
7d5ac76
to
8717556
Compare
8717556
to
7785583
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thats a huge
- Enhancement of conflict detection
- Large rewrite of some types in the property-svc
- Bare bone conflict resolution via retries
- Conflict diffs (most of this pr)
The conflict diff is done manually in our API layer. All of those areas are marked with a TODO comment to find a more generic approach later on. Are there currently any ideas how we can abstract this?
@@ -181,3 +181,46 @@ func OrEmptySlice[T any](as []T) []T { | |||
|
|||
return make([]T, 0) | |||
} | |||
|
|||
func Without[T comparable](original, itemsToRemove []T) []T { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add tests
} | ||
|
||
// SameItems yields true, iff a and b have the same elements (order may vary!) | ||
func SameItems[T comparable](a, b []T) bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add tests
PropertyValue: &models.PropertyValue{ | ||
ID: id, | ||
PropertyID: uuid.UUID{}, | ||
SubjectID: uuid.UUID{}, | ||
Value: nil, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why getting rid of the constructor?
SubjectID string `json:"subject_id"` | ||
ID string `json:"id"` | ||
PropertyID string `json:"property_id"` | ||
ValueChange models.TypedValueChange `json:"value_change"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why suffix ValueChange
with Value
? Its the value of the property. A new event for the property value has a new value.
if expConsistency != nil && *expConsistency != newToken { | ||
return newToken, &common.Conflict[*models.Property]{ | ||
Was: oldState, | ||
Is: a.Property, | ||
}, nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Every command handler has this check. Can we move this one layer down?
We discussed this via audio Before we can merge the diff/conflict detection we need to have a future plan in place to get rid of the manual mappings.
|
Which issues does this pull request close?
closes #808
closes #860
return consistency, not oldConsistency