-
Notifications
You must be signed in to change notification settings - Fork 297
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
Update the datastore interface to return the number of deleted relationships #2265
Conversation
d1c65ab
to
b1eda0f
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.
LGTM, just two nits
@@ -391,7 +391,7 @@ func (rwt spannerReadWriteTXN) DeleteNamespaces(ctx context.Context, nsNames ... | |||
// Ensure the namespace exists. | |||
|
|||
relFilter := &v1.RelationshipFilter{ResourceType: nsName} | |||
if _, err := deleteWithFilter(ctx, rwt.spannerRWT, relFilter); err != nil { | |||
if _, _, err := deleteWithFilter(ctx, rwt.spannerRWT, relFilter); err != 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.
hmm, are we dropping relationships if a namespace is deleted? Isn't that supposed to be an 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.
No; this has been a long-standing internal thing we've done. We still verify you cannot do so, but it is at the API layer, so this operation usually no-ops
pkg/datastore/datastore.go
Outdated
@@ -504,11 +504,12 @@ type ReadWriteTransaction interface { | |||
WriteRelationships(ctx context.Context, mutations []tuple.RelationshipUpdate) error | |||
|
|||
// DeleteRelationships deletes relationships that match the provided filter, with | |||
// the optional limit. If a limit is provided and reached, the method will return | |||
// true as the first return value. Otherwise, the boolean can be ignored. | |||
// the optional limit. Returnds the number of deleted relationships. If a limit |
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 optional limit. Returnds the number of deleted relationships. If a limit | |
// the optional limit. Returns the number of deleted relationships. If a limit |
b1eda0f
to
2ebd0d4
Compare
This will be added to the API in a followup