Currently, we allow using `--local-dump` in `morph init` command.
We also have this flag in other commands, but no `--protocol` which is
also needed. And in new command we do not have the ability to use local
dump at all.
This commit makes it possible to work either with an RPC or with
local-dump in every command.
Refs #1035.
Refs TrueCloudLab/frostfs-dev-env#42.
Writing gopatch this time was really satisfying, btw:
```
@@
var flags expression
@@
-flags.StringP(commonflags.EndpointFlag, ...)
+commonflags.InitRPC(flags)
@@
var flags expression
@@
-_ = viper.BindPFlag(commonflags.EndpointFlag, flags.Lookup(...))
+commonflags.BindRPC(flags)
```
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
* Use `cmd/internal/common/ape` parser commands within `ape`
subcommands
* Use flag names from `cmd/internal/common/ape
Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
* Use `cmd/internal/common/ape` parser commands within `generate-ape-override`
subcommand
* Use flag names from `cmd/internal/common/ape`
Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
* Refactor ape-manager subcommands
* Use `cmd/internal/common/ape` parser commands within ape-manager subcommands
* Use flag names from `cmd/internal/common/ape`
Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
* Refactor local override managing subcommands
* Use `cmd/internal/common/ape` parser commands within local
override subcommands
* Use flag names from `cmd/internal/common/ape`
Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
* Introduce common parsing commands to use them in `frostfs-cli`
and `frostfs-adm` APE-related subcommands
* Introduce common flags for these parsing commands
Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
* Both `frostfs-cli` and `frostfs-adm` APE-related subcommands use
`PrintHumanReadableAPEChain` to print a parsed APE-chain. So, it's
more correct to have it in a common package over `frostfs-cli` and
`frostfs-adm` folders.
Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
* `ConvertEACLToAPE` is useful method which couldn't be imported
out of frostfs-node so far as it has been in `internal`
* Since `ConvertEACLToAPE` and related structures and unit-tests
are placed in `pkg/util`
Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
Concurrent Apply can lead to child node applies before parent, so
undo/redo operations will perform. This leads to performance degradation
in case of tree with many sublevels.
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
* Register GRPC services for both neo.fs.v2 and frost.fs namespaces
* Use this temporary solution until all nodes are updated
Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
* Update version within go.mod;
* Fix deprecated frostfs-api-go/v2 package and use frostfs-sdk-go/api
instead.
Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
`slices.SortFunc` doesn't use reflection and is a bit faster.
I have done some micro-benchmarks for `[]NodeInfo`:
```
$ benchstat -col "/func" out
goos: linux
goarch: amd64
pkg: git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/pilorama
cpu: 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz
│ sort.Slice │ slices.SortFunc │
│ sec/op │ sec/op vs base │
Sort-8 2.130µ ± 2% 1.253µ ± 2% -41.20% (p=0.000 n=10)
```
Haven't included them, though, as they I don't see them being used a
lot.
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
XDG base directory specification defines where various files
should be looked by an application. Hopefully, this makes `frostfs-cli`
more predictable and pleasant to work with. Luckily for us, golang already
has everything we need in the stdlib. This commit also gets rid of
`github.com/mitchellh/go-homedir` dependency.
Close#532
Refs #1455
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
go-homedir library incorrectly handles some of the errors
that could occur. It is archived, so no PR, but let's fix it on our
side. The scenario in case: executing command in an empty environment.
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
We have several ways to specify the `rpc-endpoint`: with a flag,
with a single config file or multiple files. Before, the `rpc-endpoint`
flag was marked as required. Because `cobra` checked the required flag
presence first, it prevented specifying `rpc-endpoint` with a config file.
Signed-off-by: Aleksey Savchuk <a.savchuk@yadro.com>
Before, when the target RPC server was unavailable, requests made
by CLI didn't wait for a timeout specified by the `--timeout` option
if the timeout was more than 20 seconds. It's because of the gRPC
default backoff strategy. Adding this option fixes that behavior.
Signed-off-by: Aleksey Savchuk <a.savchuk@yadro.com>
It could be called for every shard on metabase resync concurrently and
it is possible to get state with initialized client but not initialized
contract hashes.
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>