Repository navigation
feat(storage): support for soft delete policies and restore #9520
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
Changes from 1 commit
0f865ef
e0ac127
32d6360
0fbac79
bf5d967
8495dbc
7410785
aef31dd
5e1a250
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1068,7 +1068,7 @@ func (o *ObjectHandle) SoftDeleted() *ObjectHandle { | |
| return &o2 | ||
| } | ||
|
|
||
| // Restore will restore a soft-deleted object to full object status. | ||
| // Restore will restore a soft-deleted object to a live object. | ||
| // Note that you must specify a generation to use this method. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If generation is not specified, do we get an intelligible error from the server based on whatever the Go client sends by default? Might be good to check this.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The error should be intelligible, let me check... GRPC Ah, HTTP's is no longer intelligible since it's a required param What do you suggest we do here? Set
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sending zero seems fine since the default of -1 seems to be a placeholder for the most recent generation. Or we could just return an error without sending the request since a required param is missing. @JesseLovelace what are other languages doing for this case, assuming that it is relevant? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think sending zero to get the intelligible error seems best here |
||
| // copySourceACL indicates whether the restored object should copy the | ||
| // access controls of the source object. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this only relevant for buckets with fine-grained access? If UBLA is enabled, is this ignored or does it cause an error?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the target bucket has UBLA enforced, the user will get an error warning that object ACLs will not be restored and the object will not be restored. |
||
|
|
@@ -1421,14 +1421,16 @@ type ObjectAttrs struct { | |
|
|
||
| // SoftDeleteTime is the time when the object became soft-deleted. | ||
| // Soft-deleted objects are only accessible on an object handle returned by | ||
|
tritone marked this conversation as resolved.
Resolved
|
||
| // ObjectHandle.SoftDeleted. | ||
| // ObjectHandle.SoftDeleted; if ObjectHandle.SoftDeleted has not been set, | ||
| // ObjectHandle.Attrs will return ErrObjectNotExist if the object is soft-deleted. | ||
| // This field is read-only. | ||
| SoftDeleteTime time.Time | ||
|
|
||
| // HardDeleteTime is the time when the object will be permanently deleted. | ||
| // Only set when an object becomes soft-deleted with a soft delete policy. | ||
| // Soft-deleted objects are only accessible on an object handle returned by | ||
| // ObjectHandle.SoftDeleted. | ||
| // ObjectHandle.SoftDeleted; if ObjectHandle.SoftDeleted has not been set, | ||
| // ObjectHandle.Attrs will return ErrObjectNotExist if the object is soft-deleted. | ||
| // This field is read-only. | ||
| HardDeleteTime time.Time | ||
| } | ||
|
|
@@ -1682,6 +1684,10 @@ type Query struct { | |
| // prefixes returned by the query. Only applicable if Delimiter is set to /. | ||
| // IncludeFoldersAsPrefixes is not yet implemented in the gRPC API. | ||
| IncludeFoldersAsPrefixes bool | ||
|
|
||
| // SoftDeleted indicates whether to list soft-deleted objects. If true, only | ||
| // objects that have been soft-deleted will be listed. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note as well that by default, soft deleted objects will not be listed. |
||
| SoftDeleted bool | ||
| } | ||
|
|
||
| // attrToFieldMap maps the field names of ObjectAttrs to the underlying field | ||
|
|
||
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.
We really should have samples for this feature; people are going to be so confused otherwise.