Skip to content
Permalink
Browse files

Issue ipfs#259: Address CR comments

License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
  • Loading branch information...
hsanjuan committed Dec 4, 2017
1 parent 4922c95 commit d6a7caf7a4501150ee1ff3e1f4ec84ca0b67cc2f
Showing with 18 additions and 19 deletions.
  1. +1 −2 .dockerignore
  2. +15 −15 api/rest/restapi.go
  3. +1 −1 cluster.go
  4. +1 −1 ipfs-cluster-ctl/main.go
@@ -1,2 +1 @@
Dockerfile
Dockerfile-*
Dockerfile*
@@ -378,22 +378,22 @@ func (api *API) peerRemoveHandler(w http.ResponseWriter, r *http.Request) {
}

func (api *API) pinHandler(w http.ResponseWriter, r *http.Request) {
if c := parseCidOrError(w, r); c.Cid != "" {
if ps := parseCidOrError(w, r); ps.Cid != "" {
err := api.rpcClient.Call("",
"Cluster",
"Pin",
c,
ps,
&struct{}{})
sendAcceptedResponse(w, err)
}
}

func (api *API) unpinHandler(w http.ResponseWriter, r *http.Request) {
if c := parseCidOrError(w, r); c.Cid != "" {
if ps := parseCidOrError(w, r); ps.Cid != "" {
err := api.rpcClient.Call("",
"Cluster",
"Unpin",
c,
ps,
&struct{}{})
sendAcceptedResponse(w, err)
}
@@ -410,12 +410,12 @@ func (api *API) allocationsHandler(w http.ResponseWriter, r *http.Request) {
}

func (api *API) allocationHandler(w http.ResponseWriter, r *http.Request) {
if c := parseCidOrError(w, r); c.Cid != "" {
if ps := parseCidOrError(w, r); ps.Cid != "" {
var pin types.PinSerial
err := api.rpcClient.Call("",
"Cluster",
"PinGet",
c,
ps,
&pin)
if err != nil { // errors here are 404s
sendErrorResponse(w, 404, err.Error())
@@ -452,21 +452,21 @@ func (api *API) statusHandler(w http.ResponseWriter, r *http.Request) {
queryValues := r.URL.Query()
local := queryValues.Get("local")

if c := parseCidOrError(w, r); c.Cid != "" {
if ps := parseCidOrError(w, r); ps.Cid != "" {
if local == "true" {
var pinInfo types.PinInfoSerial
err := api.rpcClient.Call("",
"Cluster",
"StatusLocal",
c,
ps,
&pinInfo)
sendResponse(w, err, pinInfoToGlobal(pinInfo))
} else {
var pinInfo types.GlobalPinInfoSerial
err := api.rpcClient.Call("",
"Cluster",
"Status",
c,
ps,
&pinInfo)
sendResponse(w, err, pinInfo)
}
@@ -500,21 +500,21 @@ func (api *API) syncHandler(w http.ResponseWriter, r *http.Request) {
queryValues := r.URL.Query()
local := queryValues.Get("local")

if c := parseCidOrError(w, r); c.Cid != "" {
if ps := parseCidOrError(w, r); ps.Cid != "" {
if local == "true" {
var pinInfo types.PinInfoSerial
err := api.rpcClient.Call("",
"Cluster",
"SyncLocal",
c,
ps,
&pinInfo)
sendResponse(w, err, pinInfoToGlobal(pinInfo))
} else {
var pinInfo types.GlobalPinInfoSerial
err := api.rpcClient.Call("",
"Cluster",
"Sync",
c,
ps,
&pinInfo)
sendResponse(w, err, pinInfo)
}
@@ -541,21 +541,21 @@ func (api *API) recoverHandler(w http.ResponseWriter, r *http.Request) {
queryValues := r.URL.Query()
local := queryValues.Get("local")

if c := parseCidOrError(w, r); c.Cid != "" {
if ps := parseCidOrError(w, r); ps.Cid != "" {
if local == "true" {
var pinInfo types.PinInfoSerial
err := api.rpcClient.Call("",
"Cluster",
"RecoverLocal",
c,
ps,
&pinInfo)
sendResponse(w, err, pinInfoToGlobal(pinInfo))
} else {
var pinInfo types.GlobalPinInfoSerial
err := api.rpcClient.Call("",
"Cluster",
"Recover",
c,
ps,
&pinInfo)
sendResponse(w, err, pinInfo)
}
@@ -883,7 +883,7 @@ func (c *Cluster) SyncAllLocal() ([]api.PinInfo, error) {
return syncedItems, err
}

// Sync triggers a LocalSyncCid() operation for a given Cid
// Sync triggers a SyncLocal() operation for a given Cid.
// in all cluster peers.
func (c *Cluster) Sync(h *cid.Cid) (api.GlobalPinInfo, error) {
return c.globalPinInfoCid("SyncLocal", h)
@@ -402,7 +402,7 @@ error state, usually because the IPFS pin or unpin operation has failed.
The command will wait for any operations to succeed and will return the status
of the item upon completion. Note that, when running on the full sets of tracked
CIDs (without argument), it may take considerable long time.
CIDs (without argument), it may take a considerably long time.
When the --local flag is passed, it will only trigger recover
operations on the contacted peer (as opposed to on every peer).

0 comments on commit d6a7caf

Please sign in to comment.
You can’t perform that action at this time.