-
Notifications
You must be signed in to change notification settings - Fork 156
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
refactor: re-define vfolder delete status #1892
Conversation
print_error(e) | ||
sys.exit(ExitCode.FAILURE) | ||
|
||
|
||
@vfolder.command() | ||
@click.argument("name", type=str) | ||
def recover(name): |
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.
Let's rename this to restore
and keep the alias for backward compatibility.
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 added restore
command right below(line no 236) and left this for backward compatibility.
pydantic_params_api_handler, | ||
pydantic_response_api_handler, |
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'd like to rename these to:
pydantic_api_params_handler
pydantic_api_reponse_handler
for consistency with composite nouns in a follow-up PR.
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.
Let's postpone this refactoring to a follow-up PR.
await ensure_vfolder_status( | ||
request, VFolderAccessStatus.HARD_DELETABLE, folder_id_or_name=folder_id | ||
) | ||
async with root_ctx.db.begin() as conn: |
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.
This could be also a readonly connection or transaction.
@@ -3296,14 +3446,13 @@ def create_app(default_cors_options): | |||
vfolder_resource = cors.add(app.router.add_resource(r"/{name}")) | |||
cors.add(vfolder_resource.add_route("GET", get_info)) | |||
cors.add(vfolder_resource.add_route("DELETE", delete_by_name)) | |||
cors.add(add_route("GET", r"/{name}/id", get_vfolder_id)) |
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 think it would be better to move the name
parameter to a query param.
Since /folders/{name}
may conflict with /folders/{invitations,purge,restore-from-trash-bin,delete-from-trash-bin}
, I'd suggest using a new app prefix: /vfolders/
for new UUID-based API routes.
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.
Let's postpone this refactoring to a follow-up PR.
refs #767
related to lablup/backend.ai-webui#2204
!! MUST
./py -m alembic upgrade head
./py -m alembic stamp head
./py -m alembic downgrade -1
,./py -m alembic stamp a5319bfc7d7c
Updates
delete-pending
,delete-error
vfolder statusdelete-pending
status as a "trash-bin" statausdelete-complete
status as vfolder hard delete in storage proxydeleted-complete
todelete-pending
recover
API torestore
. Becauserecover
is a more appropriate term when you want to retrieve a file or data after you lose it, andrestore
is more often used when you want to return to a certain point in time or state.Updated/Added API
DELETE /folders
now accepts any ofvfolder_id
,vfolderId
,id
parameter and the response contains success messagePOST /folders/restore-from-trash-bin
restores soft-deleted vfolders(aka trash-bin) into ready state.POST /folders/delete-from-trash-bin
permanently deletes vfolders in storage.POST /folders/<NAME>/purge
change toPOST /folders/purge
and getvfolder_id
parameterChecklist: (if applicable)
docs
directory