cmd/swarm: cleanup

This commit is contained in:
Fabio Barone 2019-02-03 20:45:00 -05:00
parent 5ed219efe2
commit ba3849af4a
2 changed files with 16 additions and 19 deletions

View file

@ -48,7 +48,7 @@ func explore(ctx *cli.Context) {
defer f.Close() defer f.Close()
fileStore := storage.NewFileStore(&storage.FakeChunkStore{}, storage.NewFileStoreParams()) fileStore := storage.NewFileStore(&storage.FakeChunkStore{}, storage.NewFileStoreParams())
_, err = fileStore.StoreToExplore(context.TODO(), f) _, err = fileStore.GetAllReferences(context.TODO(), f, false)
if err != nil { if err != nil {
utils.Fatalf("%v\n", err) utils.Fatalf("%v\n", err)
} else { } else {

View file

@ -29,28 +29,25 @@ var (
) )
func chunkExplorer(c *cli.Context) error { func chunkExplorer(c *cli.Context) error {
fmt.Println("generate endpoints...") log.Debug("generate endpoints...")
//generateEndpoints(scheme, cluster, appName, from, to) generateEndpoints(scheme, cluster, appName, from, to)
fmt.Println("done.") log.Debug("done.")
var has bool var has bool
//for _, e := range endpoints { for _, e := range endpoints {
e := "ws://localhost" e = e + ":8546"
fmt.Println("dialing...." + e + ":8546") log.Debug("dialing...." + e)
client, _ := rpc.Dial(e + ":8546") client, _ := rpc.Dial(e)
fmt.Println("Trying...." + e) log.Debug("Trying...." + e)
if err := client.Call(&has, "debugapi_hasChunk", addr); err != nil { if err := client.Call(&has, "debugapi_hasChunk", addr); err != nil {
fmt.Println("err")
log.Error("Error requesting hasChunk from endpoint", "endpoint", e, "chunkAddress", addr, "err", err) log.Error("Error requesting hasChunk from endpoint", "endpoint", e, "chunkAddress", addr, "err", err)
} else { } else {
if has { if has {
fmt.Println("has")
log.Info("Endpoint "+e+" reports to HAVE chunk", "chunk", addr) log.Info("Endpoint "+e+" reports to HAVE chunk", "chunk", addr)
} else { } else {
fmt.Println("not") log.Info("Endpoint "+e+" reports to NOT have chunk", "chunk", addr)
log.Debug("Endpoint "+e+" reports to NOT have chunk", "chunk", addr) }
} }
} }
//}
return nil return nil
} }