-
Notifications
You must be signed in to change notification settings - Fork 61
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 RmdirContents API in the Fileystem v2alpha1 API Group #186
Add RmdirContents API in the Fileystem v2alpha1 API Group #186
Conversation
50caaff
to
f1d1bf8
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.
Recommend starting a v2beta1 API group in filesystem
for the new changes.
f1d1bf8
to
3af8237
Compare
3544eec
to
1842fce
Compare
Thanks! /lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ddebroy, mauriciopoppe The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
1842fce
to
78eb1b3
Compare
if err != nil { | ||
return err | ||
} | ||
for _, file := range files { |
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.
you didn't implement force option here?
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.
thanks, fixed
3571adc
to
fd5fdae
Compare
/hold #187 was merged and I'll try with the prow integration test job too. |
c4e5b93
to
8c10065
Compare
8c10065
to
84ffc81
Compare
/test pull-kubernetes-csi-csi-proxy-integration |
38089c9
to
a9faf8e
Compare
/remove-hold |
string path = 1; | ||
|
||
// Force remove all contents under path (if any). | ||
bool force = 2; |
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 do we want to have this option? If force is false, it can only remove files, or empty dirs?
Does RmdirContents mean we want to remove everything under it, not just empty dirs?
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.
good observation, from LVP it's always called with force = true
and if it's false then it's like you say for, this is because I copied the message from the existing Rmdir
message
I removed the field
a9faf8e
to
f16a115
Compare
/test pull-kubernetes-csi-csi-proxy-integration |
f16a115
to
897656b
Compare
/test pull-kubernetes-csi-csi-proxy-integration |
@@ -15,6 +15,9 @@ service Filesystem { | |||
// This may be used for unlinking a symlink created through CreateSymlink. | |||
rpc Rmdir(RmdirRequest) returns (RmdirResponse) {} | |||
|
|||
// RmdirContents removes the contents of a directory in the host filesystem. |
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.
maybe add a few more words to mention contents are all the files and sub dirs under the dir. The directory itself will not be deleted.
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.
added:
// Unlike Rmdir it won't delete the requested path, it'll only delete its contents.
@@ -78,6 +80,29 @@ func (filesystemAPI) Rmdir(path string, force bool) error { | |||
return os.Remove(path) | |||
} | |||
|
|||
// RmdirContents removes the contents of a directory with `os.RemoveAll` | |||
func (filesystemAPI) RmdirContents(path string) error { | |||
dir, err := os.Open(path) |
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.
https://stackoverflow.com/a/52685448
a reference of implementation
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.
I took the same implementation as LVP for linux
897656b
to
b5442d7
Compare
/test pull-kubernetes-csi-csi-proxy-integration |
/lgtm |
What type of PR is this?
/kind api-change
/kind feature
What this PR does / why we need it:
Adds the new Filesystem API,
RmdirContents
, it removes the contents of a directory (but not the directory itself).Does this PR introduce a user-facing change?:
/cc @jingxu97 @ddebroy