frostfs-cli: Add control ir remove-container #742

Merged
fyrchik merged 1 commit from dstepanov-yadro/frostfs-node:feat/cli_remove_container into master 2023-10-19 14:30:56 +00:00

frostfs-cli control ir remove-container allows delete container directly on ir-node without owner's private key.

Closes #733

`frostfs-cli control ir remove-container` allows delete container directly on ir-node without owner's private key. Closes #733
dstepanov-yadro changed title from frostfs-cli: Add control ir remove-container to WIP: frostfs-cli: Add control ir remove-container 2023-10-16 15:19:00 +00:00
dstepanov-yadro force-pushed feat/cli_remove_container from a0c7512f05 to a19d366644 2023-10-17 10:06:33 +00:00 Compare
dstepanov-yadro force-pushed feat/cli_remove_container from a19d366644 to c0b33697be 2023-10-17 10:09:50 +00:00 Compare
dstepanov-yadro changed title from WIP: frostfs-cli: Add control ir remove-container to frostfs-cli: Add control ir remove-container 2023-10-17 10:10:21 +00:00
dstepanov-yadro requested review from storage-core-committers 2023-10-17 10:12:21 +00:00
dstepanov-yadro requested review from storage-core-developers 2023-10-17 10:12:23 +00:00
acid-ant approved these changes 2023-10-17 14:54:11 +00:00
@ -0,0 +52,4 @@
verifyResponse(cmd, resp.GetSignature(), resp.GetBody())
if len(req.GetBody().GetContainerId()) > 0 {
Member

Maybe just Operation succeeded

Maybe just `Operation succeeded`
Author
Member

I prefer more specific messages. Therefore, if it is not necessary, then I will leave it as it is.

I prefer more specific messages. Therefore, if it is not necessary, then I will leave it as it is.
fyrchik reviewed 2023-10-19 06:33:29 +00:00
@ -0,0 +81,4 @@
if len(ownerStr) > 0 {
var owner user.ID
commonCmd.ExitOnErr(cmd, "invalid owner ID: %w", owner.DecodeString(ownerStr))
req.Body.Owner = []byte(ownerStr)
Owner

Why is cid sent in raw format and owner as []byte?

Why is `cid` sent in raw format and owner as `[]byte`?
Author
Member

Fixed. Missed that user.ID is wrapper of gRPC type OwnerID.

Fixed. Missed that user.ID is wrapper of gRPC type OwnerID.
Author
Member

Also fixed some error codes

Also fixed some error codes
fyrchik marked this conversation as resolved
@ -102,0 +119,4 @@
}
}
if len(req.Body.GetOwner()) > 0 {
Owner

I would prohibit using both owner and container here too, what about returning nil from the previous if?

I would prohibit using _both_ owner and container here too, what about returning nil from the previous `if`?
Author
Member

Fixed: now this condition is checked

Fixed: now this condition is checked
fyrchik marked this conversation as resolved
@ -102,0 +131,4 @@
}
for _, containerID := range cids {
if err := s.removeContainer(containerID); err != nil {
Owner

This doesn't take long because the operation doesn't wait for persist, so me can sent >1 container in a single block?
In this case user facing message in the frostfs-cli is wrong: user containers are not removed, but queried for removal and we need some way to check progress (probably, frostfs-cli container list?)

This doesn't take long because the operation doesn't wait for persist, so me can sent >1 container in a single block? In this case user facing message in the frostfs-cli is wrong: user containers are not removed, but queried for removal and we need some way to check progress (probably, `frostfs-cli container list`?)
Author
Member

Fixed: command description and log messages changed

Fixed: command description and log messages changed
fyrchik marked this conversation as resolved
dstepanov-yadro force-pushed feat/cli_remove_container from c0b33697be to 1221eeba82 2023-10-19 08:39:03 +00:00 Compare
dstepanov-yadro force-pushed feat/cli_remove_container from 1221eeba82 to 77164dfb56 2023-10-19 08:59:46 +00:00 Compare
dstepanov-yadro force-pushed feat/cli_remove_container from 77164dfb56 to 38ade8d3f2 2023-10-19 09:09:06 +00:00 Compare
aarifullin reviewed 2023-10-19 09:20:05 +00:00
@ -68,3 +68,2 @@
// If TryNotary is provided, calls notary contract.
func (c *Client) Delete(p DeletePrm) error {
if len(p.signature) == 0 {
func (c *Client) Delete(p DeletePrm, isControl bool) error {
Member

Why have not you considered to put the flag isControl within DeletePrm?

DeletePrm is for this purpose to avoid passing many parameters to the method

Why have not you considered to put the flag `isControl` within `DeletePrm`? `DeletePrm` is for this purpose to avoid passing many parameters to the method
Author
Member

Fixed. Good point, thx.

Fixed. Good point, thx.
aarifullin marked this conversation as resolved
aarifullin reviewed 2023-10-19 09:21:26 +00:00
@ -0,0 +71,4 @@
if err != nil {
commonCmd.ExitOnErr(cmd, "failed to get cid: ", err)
}
Member

You don't need to check if err != nil if you use commonCmd.ExitOnErr

The same is fair for the check above

You don't need to check `if err != nil` if you use `commonCmd.ExitOnErr` The same is fair for the check above
Author
Member

Fixed.

Fixed.
aarifullin marked this conversation as resolved
dstepanov-yadro force-pushed feat/cli_remove_container from 38ade8d3f2 to 87af6ce4f6 2023-10-19 13:20:21 +00:00 Compare
dstepanov-yadro force-pushed feat/cli_remove_container from 87af6ce4f6 to 189dbb01be 2023-10-19 13:22:35 +00:00 Compare
aarifullin approved these changes 2023-10-19 13:50:51 +00:00
fyrchik approved these changes 2023-10-19 14:30:41 +00:00
fyrchik merged commit 189dbb01be into master 2023-10-19 14:30:56 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: TrueCloudLab/frostfs-node#742
No description provided.