| 
									
										
										
										
											2017-04-14 10:29:00 +02:00
										 |  |  | // Copyright 2017 The go-ethereum Authors | 
					
						
							|  |  |  | // This file is part of go-ethereum. | 
					
						
							| 
									
										
										
										
											2017-02-13 18:50:50 +06:30
										 |  |  | // | 
					
						
							| 
									
										
										
										
											2017-04-14 10:29:00 +02: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 18:50:50 +06:30
										 |  |  | // the Free Software Foundation, either version 3 of the License, or | 
					
						
							|  |  |  | // (at your option) any later version. | 
					
						
							|  |  |  | // | 
					
						
							| 
									
										
										
										
											2017-04-14 10:29:00 +02:00
										 |  |  | // go-ethereum is distributed in the hope that it will be useful, | 
					
						
							| 
									
										
										
										
											2017-02-13 18:50:50 +06:30
										 |  |  | // but WITHOUT ANY WARRANTY; without even the implied warranty of | 
					
						
							|  |  |  | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 
					
						
							| 
									
										
										
										
											2017-04-14 10:29:00 +02:00
										 |  |  | // GNU General Public License for more details. | 
					
						
							| 
									
										
										
										
											2017-02-13 18:50:50 +06:30
										 |  |  | // | 
					
						
							| 
									
										
										
										
											2017-04-14 10:29:00 +02: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 18:50:50 +06:30
										 |  |  | 
 | 
					
						
							|  |  |  | package main | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import ( | 
					
						
							| 
									
										
										
										
											2017-03-02 15:06:16 +02:00
										 |  |  | 	"github.com/ethereum/go-ethereum/cmd/utils" | 
					
						
							| 
									
										
										
										
											2017-02-13 18:50:50 +06:30
										 |  |  | 	"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 15:06:16 +02:00
										 |  |  | 		utils.Fatalf("Need path to chunks database as the first and only argument") | 
					
						
							| 
									
										
										
										
											2017-02-13 18:50:50 +06:30
										 |  |  | 	} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	chunkDbPath := args[0] | 
					
						
							|  |  |  | 	hash := storage.MakeHashFunc("SHA3") | 
					
						
							|  |  |  | 	dbStore, err := storage.NewDbStore(chunkDbPath, hash, 10000000, 0) | 
					
						
							|  |  |  | 	if err != nil { | 
					
						
							| 
									
										
										
										
											2017-03-02 15:06:16 +02:00
										 |  |  | 		utils.Fatalf("Cannot initialise dbstore: %v", err) | 
					
						
							| 
									
										
										
										
											2017-02-13 18:50:50 +06:30
										 |  |  | 	} | 
					
						
							|  |  |  | 	dbStore.Cleanup() | 
					
						
							|  |  |  | } |