2017-04-14 11:29:00 +03:00
|
|
|
// Copyright 2017 The go-ethereum Authors
|
|
|
|
// This file is part of go-ethereum.
|
2017-02-13 15:20:50 +03:00
|
|
|
//
|
2017-04-14 11:29:00 +03:00
|
|
|
// go-ethereum is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
2017-02-13 15:20:50 +03:00
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
2017-04-14 11:29:00 +03:00
|
|
|
// go-ethereum is distributed in the hope that it will be useful,
|
2017-02-13 15:20:50 +03:00
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2017-04-14 11:29:00 +03:00
|
|
|
// GNU General Public License for more details.
|
2017-02-13 15:20:50 +03:00
|
|
|
//
|
2017-04-14 11:29:00 +03:00
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
|
2017-02-13 15:20:50 +03:00
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2017-03-02 16:06:16 +03:00
|
|
|
"github.com/ethereum/go-ethereum/cmd/utils"
|
2017-02-13 15:20:50 +03:00
|
|
|
"github.com/ethereum/go-ethereum/swarm/storage"
|
|
|
|
"gopkg.in/urfave/cli.v1"
|
|
|
|
)
|
|
|
|
|
|
|
|
func cleandb(ctx *cli.Context) {
|
|
|
|
args := ctx.Args()
|
|
|
|
if len(args) != 1 {
|
2017-03-02 16:06:16 +03:00
|
|
|
utils.Fatalf("Need path to chunks database as the first and only argument")
|
2017-02-13 15:20:50 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
chunkDbPath := args[0]
|
|
|
|
hash := storage.MakeHashFunc("SHA3")
|
|
|
|
dbStore, err := storage.NewDbStore(chunkDbPath, hash, 10000000, 0)
|
|
|
|
if err != nil {
|
2017-03-02 16:06:16 +03:00
|
|
|
utils.Fatalf("Cannot initialise dbstore: %v", err)
|
2017-02-13 15:20:50 +03:00
|
|
|
}
|
|
|
|
dbStore.Cleanup()
|
|
|
|
}
|