Skip to content

Commit

Permalink
Issue ipfs-cluster#446 Adding peername to PinInfo
Browse files Browse the repository at this point in the history
Removed comments and code used for debugging

License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
  • Loading branch information
kishansagathiya committed Sep 24, 2018
1 parent ef85ba8 commit 773b4de
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 17 deletions.
1 change: 0 additions & 1 deletion api/rest/client/methods.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ func (c *Client) Status(ci cid.Cid, local bool) (api.GlobalPinInfo, error) {

// StatusAll gathers Status() for all tracked items.
func (c *Client) StatusAll(local bool) ([]api.GlobalPinInfo, error) {
println("methods StatusAll")
var gpis []api.GlobalPinInfoSerial
err := c.do("GET", fmt.Sprintf("/pins?local=%t", local), nil, nil, &gpis)
result := make([]api.GlobalPinInfo, len(gpis))
Expand Down
2 changes: 0 additions & 2 deletions api/rest/restapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,6 @@ func (api *API) statusAllHandler(w http.ResponseWriter, r *http.Request) {
local := queryValues.Get("local")

if local == "true" {
println("restapi true")
var pinInfos []types.PinInfoSerial
err := api.rpcClient.Call("",
"Cluster",
Expand All @@ -669,7 +668,6 @@ func (api *API) statusAllHandler(w http.ResponseWriter, r *http.Request) {
&pinInfos)
sendResponse(w, err, pinInfosToGlobal(pinInfos))
} else {
println("restapi false")
var pinInfos []types.GlobalPinInfoSerial
err := api.rpcClient.Call("",
"Cluster",
Expand Down
4 changes: 0 additions & 4 deletions cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -1215,7 +1215,6 @@ func (c *Cluster) globalPinInfoSlice(method string) ([]api.GlobalPinInfo, error)

mergePins := func(pins []api.PinInfoSerial) {
for _, pserial := range pins {
println("peername" + pserial.PeerName)
p := pserial.ToPinInfo()
item, ok := fullMap[pserial.Cid]
if !ok {
Expand All @@ -1237,9 +1236,6 @@ func (c *Cluster) globalPinInfoSlice(method string) ([]api.GlobalPinInfo, error)
logger.Errorf("%s: error in broadcast response from %s: %s ", c.id, members[i], e)
erroredPeers[members[i]] = e.Error()
} else {
for _, k := range r {
println("merging " + k.PeerName)
}
mergePins(r)
}
}
Expand Down
5 changes: 0 additions & 5 deletions ipfs-cluster-ctl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,6 @@ The filter only takes effect when listing all pins. The possible values are:
},
},
{
// This could be one
Name: "status",
Usage: "Retrieve the status of tracked items",
Description: `
Expand All @@ -623,21 +622,18 @@ contacted cluster peer. By default, status will be fetched from all peers.
Action: func(c *cli.Context) error {
cidStr := c.Args().First()
if cidStr != "" {
println("Yo man")
ci, err := cid.Decode(cidStr)
checkErr("parsing cid", err)
resp, cerr := globalClient.Status(ci, c.Bool("local"))
formatResponse(c, resp, cerr)
} else {
println("No man")
resp, cerr := globalClient.StatusAll(c.Bool("local"))
formatResponse(c, resp, cerr)
}
return nil
},
},
{
// Anothere
Name: "sync",
Usage: "Sync status of tracked items",
Description: `
Expand Down Expand Up @@ -696,7 +692,6 @@ operations on the contacted peer (as opposed to on every peer).
if cidStr != "" {
ci, err := cid.Decode(cidStr)
checkErr("parsing cid", err)
// This one too
resp, cerr := globalClient.Recover(ci, c.Bool("local"))
formatResponse(c, resp, cerr)
} else {
Expand Down
1 change: 0 additions & 1 deletion pintracker/maptracker/maptracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@ func (mpt *MapPinTracker) Status(c cid.Cid) api.PinInfo {
// StatusAll returns information for all Cids tracked by this
// MapPinTracker.
func (mpt *MapPinTracker) StatusAll() []api.PinInfo {
println("maptracker")
return mpt.optracker.GetAll()
}

Expand Down
4 changes: 0 additions & 4 deletions pintracker/optracker/operationtracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ func (opt *OperationTracker) SetError(c cid.Cid, err error) {

func (opt *OperationTracker) unsafePinInfo(op *Operation) api.PinInfo {
if op == nil {
println("Are we here")
return api.PinInfo{
Cid: cid.Undef,
Peer: opt.pid,
Expand All @@ -120,7 +119,6 @@ func (opt *OperationTracker) unsafePinInfo(op *Operation) api.PinInfo {
PeerName: opt.peerName,
}
}
println("Then I guess we are we here" + opt.peerName)
return api.PinInfo{
Cid: op.Cid(),
Peer: opt.pid,
Expand Down Expand Up @@ -162,8 +160,6 @@ func (opt *OperationTracker) GetAll() []api.PinInfo {
opt.mu.RLock()
defer opt.mu.RUnlock()
for _, op := range opt.operations {
pi := opt.unsafePinInfo(op)
println("operationTracker" + pi.PeerName)
pinfos = append(pinfos, opt.unsafePinInfo(op))
}
return pinfos
Expand Down

0 comments on commit 773b4de

Please sign in to comment.