Merge pull request #3760 from nspcc-dev/default-attr

cli: take care of `upload-bin` defaults
This commit is contained in:
Anna Shaleva 2024-12-17 16:13:21 +03:00 committed by GitHub
commit c27101a97c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 17 additions and 39 deletions

View file

@ -57,16 +57,16 @@ func NewCommands() []*cli.Command {
Action: cmdargs.EnsureNotEmpty("container"), Action: cmdargs.EnsureNotEmpty("container"),
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "block-attribute", Name: "block-attribute",
Usage: "Attribute key of the block object", Usage: "Attribute key of the block object",
Required: true, Value: neofs.DefaultBlockAttribute,
Action: cmdargs.EnsureNotEmpty("block-attribute"), Action: cmdargs.EnsureNotEmpty("block-attribute"),
}, },
&cli.StringFlag{ &cli.StringFlag{
Name: "index-attribute", Name: "index-attribute",
Usage: "Attribute key of the index file object", Usage: "Attribute key of the index file object",
Required: true, Value: neofs.DefaultIndexFileAttribute,
Action: cmdargs.EnsureNotEmpty("index-attribute"), Action: cmdargs.EnsureNotEmpty("index-attribute"),
}, },
&flags.AddressFlag{ &flags.AddressFlag{
Name: "address", Name: "address",
@ -80,12 +80,12 @@ func NewCommands() []*cli.Command {
&cli.UintFlag{ &cli.UintFlag{
Name: "workers", Name: "workers",
Usage: "Number of workers to fetch and upload blocks concurrently", Usage: "Number of workers to fetch and upload blocks concurrently",
Value: 50, Value: 20,
}, },
&cli.UintFlag{ &cli.UintFlag{
Name: "searchers", Name: "searchers",
Usage: "Number of concurrent searches for blocks", Usage: "Number of concurrent searches for blocks",
Value: 20, Value: 100,
}, },
&cli.UintFlag{ &cli.UintFlag{
Name: "retries", Name: "retries",

View file

@ -75,37 +75,14 @@ shuts down automatically.
### NeoFS Upload Command ### NeoFS Upload Command
The `upload-bin` command is designed to fetch blocks from the RPC node and upload The `upload-bin` command is designed to fetch blocks from the RPC node and upload
them to the NeoFS container. them to the NeoFS container. It also creates and uploads index files. Below is an
It also creates and uploads index files. Below is an example usage of the command: example usage of the command:
```shell ```shell
./bin/neo-go util upload-bin --cid 9iVfUg8aDHKjPC4LhQXEkVUM4HDkR7UCXYLs8NQwYfSG --wallet-config ./wallet-config.yml --block-attribute Block --index-attribute Index --rpc-endpoint https://rpc.t5.n3.nspcc.ru:20331 -fsr st1.t5.fs.neo.org:8080 -fsr st2.t5.fs.neo.org:8080 -fsr st3.t5.fs.neo.org:8080 ./bin/neo-go util upload-bin --cid 9iVfUg8aDHKjPC4LhQXEkVUM4HDkR7UCXYLs8NQwYfSG --wallet-config ./wallet-config.yml --block-attribute Block --index-attribute Index --rpc-endpoint https://rpc.t5.n3.nspcc.ru:20331 -fsr st1.t5.fs.neo.org:8080 -fsr st2.t5.fs.neo.org:8080 -fsr st3.t5.fs.neo.org:8080
``` ```
The command supports the following options:
```
NAME:
neo-go util upload-bin - Fetch blocks from RPC node and upload them to the NeoFS container
USAGE: Run `./bin/neo-go util upload-bin --help` to see the full list of supported options.
neo-go util upload-bin --fs-rpc-endpoint <address1>[,<address2>[...]] --container <cid> --block-attribute block --index-attribute index --rpc-endpoint <node> [--timeout <time>] --wallet <wallet> [--wallet-config <config>] [--address <address>] [--workers <num>] [--searchers <num>] [--index-file-size <size>] [--retries <num>] [--debug]
OPTIONS:
--fs-rpc-endpoint value, --fsr value [ --fs-rpc-endpoint value, --fsr value ] List of NeoFS storage node RPC addresses (comma-separated or multiple --fs-rpc-endpoint flags)
--container value, --cid value NeoFS container ID to upload blocks to
--block-attribute value Attribute key of the block object
--index-attribute value Attribute key of the index file object
--address value Address to use for signing the uploading and searching transactions in NeoFS
--index-file-size value Size of index file (default: 128000)
--workers value Number of workers to fetch, upload and search blocks concurrently (default: 50)
--searchers value Number of concurrent searches for blocks (default: 20)
--retries value Maximum number of Neo/NeoFS node request retries (default: 5)
--debug, -d Enable debug logging (LOTS of output, overrides configuration) (default: false)
--rpc-endpoint value, -r value RPC node address
--timeout value, -s value Timeout for the operation (default: 10s)
--wallet value, -w value Wallet to use to get the key for transaction signing; conflicts with --wallet-config flag
--wallet-config value Path to wallet config to use to get the key for transaction signing; conflicts with --wallet flag
--help, -h show help
```
This command works as follows: This command works as follows:
1. Fetches the current block height from the RPC node. 1. Fetches the current block height from the RPC node.
@ -117,10 +94,11 @@ This command works as follows:
7. Repeats steps 4-6 until the current block height is reached. 7. Repeats steps 4-6 until the current block height is reached.
If the command is interrupted, it can be resumed. It starts the uploading process If the command is interrupted, it can be resumed. It starts the uploading process
from the last uploaded index file. from the last uploaded index file.
For a given block sequence, only one type of index file is supported. If new index For a given block sequence, only one type of index file is supported. If new index
files are needed (different `index-file-size` or `index-attribute`), the entire files are needed (different `index-file-size` or `index-attribute`), `upload-bin`
block sequence must be uploaded from the beginning. Please, add a comment to the will upload the entire block sequence starting from genesis since no migration is
supported yet by this command. Please, add a comment to the
[#3744](https://github.com/nspcc-dev/neo-go/issues/3744) issue if you need this [#3744](https://github.com/nspcc-dev/neo-go/issues/3744) issue if you need this
functionality. functionality.