-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Add conditional update methods for AccessList
and AccessListMembers
#40036
Conversation
This PR adds two new methods for conditinally update an AccessList and AccessListMember resources to avoid overriding changed resources. This is a preparation for a ineligible status reconciler. Signed-off-by: Tiago Silva <[email protected]>
Co-authored-by: rosstimothy <[email protected]>
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.
Left a few comments + linter complains about formatting.
@@ -33,6 +33,8 @@ service AccessListService { | |||
rpc GetAccessList(GetAccessListRequest) returns (AccessList); | |||
// UpsertAccessList creates or updates an access list resource. | |||
rpc UpsertAccessList(UpsertAccessListRequest) returns (AccessList); | |||
// UpdateAccessList updates an access list resource. | |||
rpc UpdateAccessList(UpdateAccessListRequest) returns (AccessList); |
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.
What is the difference between update and upsert? Those two methods sound confusing when you want to modify an access list.
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.
Upsert creates or unconditionally updates the access list - i,e. it doesn't care about revision. It will just replace whatever is in backend.
Update cares about revision and forces the revision to match before doing the update. If the revision doesn't match, it returns an error trace.CompareFailed
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.
Update and Upsert are pretty standard RPCs for our resources. See RFD 153 for the semantics and expected behaviors.
@@ -184,6 +184,44 @@ func (a *AccessListService) UpsertAccessList(ctx context.Context, accessList *ac | |||
return upserted, nil | |||
} | |||
|
|||
// UpdateAccessList updates an access list resource. | |||
func (a *AccessListService) UpdateAccessList(ctx context.Context, accessList *accesslist.AccessList) (*accesslist.AccessList, error) { |
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.
The body of this function is almost the same as UpsertAccessList
. Creating a common implementation for both will make the maintenance simpler.
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.
Will simplify
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.
done in 854509c
854509c
to
5cc5dfb
Compare
…s` (#40036) * Add conditional update methods for `AccessList` and `AccessListMembers` This PR adds two new methods for conditinally update an AccessList and AccessListMember resources to avoid overriding changed resources. This is a preparation for a ineligible status reconciler. Signed-off-by: Tiago Silva <[email protected]> * Update lib/services/simple/access_list.go Co-authored-by: rosstimothy <[email protected]> * handle review comments and drop copy methods * simplify code --------- Signed-off-by: Tiago Silva <[email protected]> Co-authored-by: rosstimothy <[email protected]>
…s` (#40036) (#40317) * Add conditional update methods for `AccessList` and `AccessListMembers` This PR adds two new methods for conditinally update an AccessList and AccessListMember resources to avoid overriding changed resources. This is a preparation for a ineligible status reconciler. * Update lib/services/simple/access_list.go * handle review comments and drop copy methods * simplify code --------- Signed-off-by: Tiago Silva <[email protected]> Co-authored-by: rosstimothy <[email protected]>
…s` (#40036) * Add conditional update methods for `AccessList` and `AccessListMembers` This PR adds two new methods for conditinally update an AccessList and AccessListMember resources to avoid overriding changed resources. This is a preparation for a ineligible status reconciler. Signed-off-by: Tiago Silva <[email protected]> * Update lib/services/simple/access_list.go Co-authored-by: rosstimothy <[email protected]> * handle review comments and drop copy methods * simplify code --------- Signed-off-by: Tiago Silva <[email protected]> Co-authored-by: rosstimothy <[email protected]>
…s` (#40036) (#40318) * Add conditional update methods for `AccessList` and `AccessListMembers` This PR adds two new methods for conditinally update an AccessList and AccessListMember resources to avoid overriding changed resources. This is a preparation for a ineligible status reconciler. * Update lib/services/simple/access_list.go * handle review comments and drop copy methods * simplify code --------- Signed-off-by: Tiago Silva <[email protected]> Co-authored-by: rosstimothy <[email protected]>
This PR adds two new methods for conditionally update an
AccessList
andAccessListMember
resources to avoid overriding changed resources.This is a preparation for a ineligible status reconciler.