aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/swarm/db.go
diff options
context:
space:
mode:
authorElad <theman@elad.im>2018-10-12 20:51:38 +0800
committerAnton Evangelatov <anton.evangelatov@gmail.com>2018-10-12 20:51:38 +0800
commit4868964bb99facd8cc6149626023e64db14a6742 (patch)
tree858bfaddcb1f1381e3bb2e0dd4c72aed397e621d /cmd/swarm/db.go
parent6f607de5d590ff2fbe8798b04e5924be3b7ca0b4 (diff)
downloaddexon-4868964bb99facd8cc6149626023e64db14a6742.tar
dexon-4868964bb99facd8cc6149626023e64db14a6742.tar.gz
dexon-4868964bb99facd8cc6149626023e64db14a6742.tar.bz2
dexon-4868964bb99facd8cc6149626023e64db14a6742.tar.lz
dexon-4868964bb99facd8cc6149626023e64db14a6742.tar.xz
dexon-4868964bb99facd8cc6149626023e64db14a6742.tar.zst
dexon-4868964bb99facd8cc6149626023e64db14a6742.zip
cmd/swarm: split flags and cli command declarations to the relevant files (#17896)
Diffstat (limited to 'cmd/swarm/db.go')
-rw-r--r--cmd/swarm/db.go42
1 files changed, 42 insertions, 0 deletions
diff --git a/cmd/swarm/db.go b/cmd/swarm/db.go
index 107fbf100..7916beffc 100644
--- a/cmd/swarm/db.go
+++ b/cmd/swarm/db.go
@@ -29,6 +29,48 @@ import (
"gopkg.in/urfave/cli.v1"
)
+var dbCommand = cli.Command{
+ Name: "db",
+ CustomHelpTemplate: helpTemplate,
+ Usage: "manage the local chunk database",
+ ArgsUsage: "db COMMAND",
+ Description: "Manage the local chunk database",
+ Subcommands: []cli.Command{
+ {
+ Action: dbExport,
+ CustomHelpTemplate: helpTemplate,
+ Name: "export",
+ Usage: "export a local chunk database as a tar archive (use - to send to stdout)",
+ ArgsUsage: "<chunkdb> <file>",
+ Description: `
+Export a local chunk database as a tar archive (use - to send to stdout).
+
+ swarm db export ~/.ethereum/swarm/bzz-KEY/chunks chunks.tar
+
+The export may be quite large, consider piping the output through the Unix
+pv(1) tool to get a progress bar:
+
+ swarm db export ~/.ethereum/swarm/bzz-KEY/chunks - | pv > chunks.tar
+`,
+ },
+ {
+ Action: dbImport,
+ CustomHelpTemplate: helpTemplate,
+ Name: "import",
+ Usage: "import chunks from a tar archive into a local chunk database (use - to read from stdin)",
+ ArgsUsage: "<chunkdb> <file>",
+ Description: `Import chunks from a tar archive into a local chunk database (use - to read from stdin).
+
+ swarm db import ~/.ethereum/swarm/bzz-KEY/chunks chunks.tar
+
+The import may be quite large, consider piping the input through the Unix
+pv(1) tool to get a progress bar:
+
+ pv chunks.tar | swarm db import ~/.ethereum/swarm/bzz-KEY/chunks -`,
+ },
+ },
+}
+
func dbExport(ctx *cli.Context) {
args := ctx.Args()
if len(args) != 3 {