mirror of
https://github.com/nspcc-dev/neofs-node.git
synced 2026-03-01 04:29:10 +00:00
NeoFS CLI refactor proposal #404
Labels
No labels
I1
I2
I3
I4
S0
S1
S2
S3
S4
U0
U1
U2
U3
U4
blocked
bug
config
dependencies
discussion
documentation
enhancement
enhancement
epic
feature
go
good first issue
help wanted
neofs-adm
neofs-cli
neofs-cli
neofs-cli
neofs-ir
neofs-lens
neofs-storage
neofs-storage
performance
question
security
task
test
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
nspcc-dev/neofs-node#404
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Originally created by @alexvanin on GitHub (Jan 10, 2022).
Originally assigned to: @alexvanin on GitHub.
This is the draft of NeoFS CLI refactor proposal. I believe that refactor will simplify introduction of new sub sections and sub commands into the application, such as
util eacl-builder. Right now we have flat structure with one package for whole application.Single package is great for sharing helper functions between sections. We share private key obtaining function, flag initialization, etc. However these section files slowly grow larger.
utilsection already includes multiple sub sections and sub commands, and this is becoming hard to maintain.I want to address this issue with two changes.
Define sections and sub sections in packages
In the example above,
utilsection is defined inmodules/utilpackage and locode sub section is stored inmodules/util/locodepackage.generatecommand is defined in correspondinggenerate.gofile there.Every section will contain
root.gofile that includes definition of the section. Files that describe commands define command and it's implementation.Share code in internal packages
There are plenty of code that shared among these sections. It can be stored in internal package the same way as client, even though it should be removed.
I tried such structure
errorpackage definesErrFandExitOnErrorwrappers, widely used in applicationflagscontains constants for all shared flags and bindingsiopackage defines function for reading values from flags (fetching private key, bearer and session tokens, etc.) and providing wrappers to print formatted values.Example
PoC for
utilsub command can be found there https://github.com/alexvanin/neofs-node/tree/refactor/group-cli-commandsComments are appreciated.
/cc @fyrchik @cthulhu-rider @carpawell
Work scope
@cthulhu-rider commented on GitHub (Jan 11, 2022):
I think the proposal will have a very good impact on readability and maintainability. The package/directory tree can mimic the command hierarchy in the CLI which will make it easier to navigate through the code.
Don't you think that such a restructuring will be an argument for keeping the
clientpackage? The need to share client features between components is in great demand inneofs-cli, and the proposed division will quite noticeably split the client's use cases into many small ones, which can complicate its support and understanding.@realloc commented on GitHub (Jan 11, 2022):
Agree, this change would make the
neofs-climore maintainable.