Skip to content

Commit

Permalink
cli: add upload-bin
Browse files Browse the repository at this point in the history
This command is used for keeping container with blocks for
blockfetcher updated.

Close #3578

Signed-off-by: Ekaterina Pavlova <[email protected]>
  • Loading branch information
AliceInHunterland committed Oct 5, 2024
1 parent 9a38360 commit 1ddbbda
Show file tree
Hide file tree
Showing 2 changed files with 405 additions and 0 deletions.
45 changes: 45 additions & 0 deletions cli/util/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"os"

"github.com/nspcc-dev/neo-go/cli/cmdargs"
"github.com/nspcc-dev/neo-go/cli/flags"
"github.com/nspcc-dev/neo-go/cli/options"
"github.com/nspcc-dev/neo-go/cli/txctx"
Expand All @@ -32,6 +33,43 @@ func NewCommands() []*cli.Command {
txctx.AwaitFlag,
}, options.RPC...)
txCancelFlags = append(txCancelFlags, options.Wallet...)
putFlags := append([]cli.Flag{
&cli.StringSliceFlag{
Name: "fs-rpc-endpoint",
Aliases: []string{"fsr"},
Usage: "List of NeoFS storage node RPC addresses (comma-separated or multiple --fs-rpc-endpoint flags)",
Required: true,
},
&cli.StringFlag{
Name: "container",
Aliases: []string{"cid"},
Usage: "NeoFS container ID to upload blocks to",
Required: true,
Action: cmdargs.EnsureNotEmpty("container"),
},
&cli.StringFlag{
Name: "block-attribute",
Usage: "Attribute key of the block object",
Required: true,
Action: cmdargs.EnsureNotEmpty("block-attribute"),
},
&cli.StringFlag{
Name: "index-attribute",
Usage: "Attribute key of the index file object",
Required: true,
Action: cmdargs.EnsureNotEmpty("index-attribute"),
},
&flags.AddressFlag{
Name: "address",
Usage: "Address to use for signing the uploading and searching transactions in NeoFS",
},
&cli.UintFlag{
Name: "index-file-size",
Usage: "Size of index file",
Value: 128000,
},
}, options.RPC...)
putFlags = append(putFlags, options.Wallet...)
return []*cli.Command{
{
Name: "util",
Expand Down Expand Up @@ -109,6 +147,13 @@ func NewCommands() []*cli.Command {
},
},
},
{
Name: "upload-bin",
Usage: "Fetch blocks from RPC node and upload it to the NeoFS container",
UsageText: "neo-go util upload-bin --fs-rpc-endpoint address --container cid --block-attribute string --index-attribute string --rpc-endpoint address --wallet wallet [--wallet-config config] [--address address]",
Action: uploadBin,
Flags: putFlags,
},
},
},
}
Expand Down
Loading

0 comments on commit 1ddbbda

Please sign in to comment.