[#390] cli: Support more tree service API calls in CLI #488
No reviewers
Labels
No labels
P0
P1
P2
P3
badger
frostfs-adm
frostfs-cli
frostfs-ir
frostfs-lens
frostfs-node
good first issue
triage
Infrastructure
blocked
bug
config
discussion
documentation
duplicate
enhancement
go
help wanted
internal
invalid
kludge
observability
perfomance
question
refactoring
wontfix
No milestone
No project
No assignees
5 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: TrueCloudLab/frostfs-node#488
Loading…
Reference in a new issue
No description provided.
Delete branch "aarifullin/frostfs-node:feature/390-tree_cli"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Signed-off-by: Airat Arifullin a.arifullin@yadro.com
In the issue @alexvanin said
I am not sure that someone can use these API calls with clear intention. I think the only reason is to disable
sync
service and debug something.Let's discuss here if really need these methods. If it's necessary, I will add two more command
8135e79e9e
to1a8b0db078
@ -0,0 +10,4 @@
var healthcheckCmd = &cobra.Command{
Use: "healthcheck",
Short: "Move node",
copy pasta
@ -0,0 +73,4 @@
}
commonCmd.ExitOnErr(cmd, "message signing: %w", tree.SignMessage(subTreeReq, pk))
resp, err := cli.GetSubTree(ctx, subTreeReq)
commonCmd.ExitOnErr(cmd, "rpc call: %w", err)
it's harder to understand what went wrong if all errors say
"rpc call: %w"
. Maybe use more specific error messages? e.g."getting subtree: %v"
and so on.Okay. I'll make these errors more verbose 👍
Fixed
@ -0,0 +99,4 @@
},
}
commonCmd.ExitOnErr(cmd, "message signing: %w", tree.SignMessage(req, pk))
"signing message: %w"
?1a8b0db078
to45be78f281
Apply
is not needed indeed.GetOpLog
can be useful for debugging (as an example -- check whether a particular log operation is in tree)45be78f281
tod99960021d
@ -0,0 +46,4 @@
ctx := cmd.Context()
cli, err := _client(ctx)
commonCmd.ExitOnErr(cmd, "client: %w", err)
`failed to create clietn' will be better, I think.
d99960021d
to4a48ca6cb3
@ -65,3 +70,3 @@
}
commonCmd.ExitOnErr(cmd, "message signing: %w", tree.SignMessage(req, pk))
commonCmd.ExitOnErr(cmd, "signing message: %w", tree.SignMessage(req, pk))
signing message
->failed to sign request
and so on. I think error messages must be clear for user, not only for developer. Or am I bothering too much? @fyrchik what do you think?IMHO, it's shorter/easier to structure it this way (i.e. present/past continuous form: actual error). This usually matches well and intuitively looks like
what was happening: what went wrong while doing that
.@ -51,3 +51,3 @@
cli, err := _client(ctx)
commonCmd.ExitOnErr(cmd, "client: %w", err)
commonCmd.ExitOnErr(cmd, "failed to create client: %w", err)
Unrelated to the commit.
@ -55,3 +55,4 @@
rawCID := make([]byte, sha256.Size)
cnr.Encode(rawCID)
var bt []byte
This also seems like a separate commit with bearer addition to existing methods.
@ -68,3 +73,3 @@
resp, err := cli.Add(ctx, req)
commonCmd.ExitOnErr(cmd, "rpc call: %w", err)
commonCmd.ExitOnErr(cmd, "add: %w", err)
Please, could you move all wording-only changes to a separate commit?
Ofc
I have splitted the PR into 3 commits. Check this out, please!
4a48ca6cb3
to6ce35c0a2d
@ -0,0 +103,4 @@
_, err = cli.Move(ctx, req)
commonCmd.ExitOnErr(cmd, "failed to call move: %w", err)
cmd.Println("Success.")
Maybe
common.PrintVerbose
?@ -26,2 +36,4 @@
treeIDFlagKey = "tid"
parentIDFlagKey = "pid"
nodeIDFlagKey = "nid"
rootIDFlagKey = "rid"
What about
--root
? It is easy to get lost in 3-letter words.Good point
6ce35c0a2d
tod92569f2df