2018-08-23 12:12:55 +00:00
|
|
|
// The ipfs-cluster-ctl application.
|
2016-12-22 16:14:15 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2018-03-14 08:49:49 +00:00
|
|
|
"context"
|
2018-03-15 16:15:23 +00:00
|
|
|
"encoding/hex"
|
2017-12-05 20:44:22 +00:00
|
|
|
"errors"
|
2016-12-22 16:14:15 +00:00
|
|
|
"fmt"
|
2017-10-13 21:12:46 +00:00
|
|
|
"io"
|
2016-12-22 16:14:15 +00:00
|
|
|
"os"
|
|
|
|
"strings"
|
2018-08-08 19:11:26 +00:00
|
|
|
"sync"
|
2016-12-22 16:14:15 +00:00
|
|
|
"time"
|
|
|
|
|
2018-03-15 16:15:23 +00:00
|
|
|
"github.com/ipfs/ipfs-cluster/api"
|
|
|
|
"github.com/ipfs/ipfs-cluster/api/rest/client"
|
|
|
|
|
2016-12-22 16:14:15 +00:00
|
|
|
cid "github.com/ipfs/go-cid"
|
2020-03-13 20:40:02 +00:00
|
|
|
logging "github.com/ipfs/go-log/v2"
|
2019-06-14 10:41:11 +00:00
|
|
|
peer "github.com/libp2p/go-libp2p-core/peer"
|
2017-01-30 12:12:25 +00:00
|
|
|
ma "github.com/multiformats/go-multiaddr"
|
2019-04-29 16:57:13 +00:00
|
|
|
|
2019-06-14 10:41:11 +00:00
|
|
|
uuid "github.com/google/uuid"
|
|
|
|
cli "github.com/urfave/cli"
|
2016-12-22 16:14:15 +00:00
|
|
|
)
|
|
|
|
|
2017-01-23 12:34:22 +00:00
|
|
|
const programName = `ipfs-cluster-ctl`
|
2016-12-22 16:14:15 +00:00
|
|
|
|
2017-01-25 17:10:18 +00:00
|
|
|
// Version is the cluster-ctl tool version. It should match
|
|
|
|
// the IPFS cluster's version
|
2020-05-19 08:10:08 +00:00
|
|
|
const Version = "0.13.0-next"
|
2017-01-24 14:06:17 +00:00
|
|
|
|
2016-12-22 16:14:15 +00:00
|
|
|
var (
|
2018-03-28 14:04:21 +00:00
|
|
|
defaultHost = "/ip4/127.0.0.1/tcp/9094"
|
2018-08-08 19:11:26 +00:00
|
|
|
defaultTimeout = 0
|
2018-03-28 14:04:21 +00:00
|
|
|
defaultWaitCheckFreq = time.Second
|
2018-08-06 10:44:44 +00:00
|
|
|
defaultAddParams = api.DefaultAddParams()
|
2016-12-22 16:14:15 +00:00
|
|
|
)
|
|
|
|
|
2017-01-24 14:06:17 +00:00
|
|
|
var logger = logging.Logger("cluster-ctl")
|
2016-12-22 16:14:15 +00:00
|
|
|
|
2018-08-30 23:14:06 +00:00
|
|
|
var globalClient client.Client
|
2017-12-05 20:44:22 +00:00
|
|
|
|
2016-12-22 16:14:15 +00:00
|
|
|
// Description provides a short summary of the functionality of this tool
|
|
|
|
var Description = fmt.Sprintf(`
|
2017-01-24 14:06:17 +00:00
|
|
|
%s is a tool to manage IPFS Cluster nodes.
|
|
|
|
Use "%s help" to list all available commands and
|
|
|
|
"%s help <command>" to get usage information for a
|
|
|
|
specific one.
|
2016-12-22 16:14:15 +00:00
|
|
|
|
2017-01-23 13:21:26 +00:00
|
|
|
%s uses the IPFS Cluster API to perform requests and display
|
2016-12-22 16:14:15 +00:00
|
|
|
responses in a user-readable format. The location of the IPFS
|
|
|
|
Cluster server is assumed to be %s, but can be
|
2018-03-16 18:37:52 +00:00
|
|
|
configured with the --host option. To use the secure libp2p-http
|
|
|
|
API endpoint, use "--host" with the full cluster libp2p listener
|
2019-08-11 13:36:45 +00:00
|
|
|
address (including the "/p2p/<peerID>" part), and --secret (the
|
2018-03-20 18:35:42 +00:00
|
|
|
32-byte cluster secret as it appears in the cluster configuration).
|
2016-12-22 16:14:15 +00:00
|
|
|
|
|
|
|
For feedback, bug reports or any additional information, visit
|
|
|
|
https://github.com/ipfs/ipfs-cluster.
|
|
|
|
`,
|
|
|
|
programName,
|
|
|
|
programName,
|
|
|
|
programName,
|
|
|
|
programName,
|
|
|
|
defaultHost)
|
|
|
|
|
2020-04-14 17:58:00 +00:00
|
|
|
// type peerAddBody struct {
|
|
|
|
// Addr string `json:"peer_multiaddress"`
|
|
|
|
// }
|
2017-01-30 12:12:25 +00:00
|
|
|
|
2017-01-24 14:06:17 +00:00
|
|
|
func out(m string, a ...interface{}) {
|
|
|
|
fmt.Fprintf(os.Stderr, m, a...)
|
2016-12-22 16:14:15 +00:00
|
|
|
}
|
|
|
|
|
2017-01-24 14:06:17 +00:00
|
|
|
func checkErr(doing string, err error) {
|
|
|
|
if err != nil {
|
|
|
|
out("error %s: %s\n", doing, err)
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
}
|
2016-12-22 16:14:15 +00:00
|
|
|
|
2017-01-24 14:06:17 +00:00
|
|
|
func main() {
|
2018-06-27 04:03:15 +00:00
|
|
|
ctx := context.Background()
|
|
|
|
|
2017-01-24 14:06:17 +00:00
|
|
|
app := cli.NewApp()
|
|
|
|
app.Name = programName
|
|
|
|
app.Usage = "CLI for IPFS Cluster"
|
2017-07-03 16:36:00 +00:00
|
|
|
app.Description = Description
|
2017-01-24 14:06:17 +00:00
|
|
|
app.Version = Version
|
|
|
|
app.Flags = []cli.Flag{
|
|
|
|
cli.StringFlag{
|
|
|
|
Name: "host, l",
|
|
|
|
Value: defaultHost,
|
2018-03-16 18:37:52 +00:00
|
|
|
Usage: "Cluster's HTTP or LibP2P-HTTP API endpoint",
|
2018-03-15 16:15:23 +00:00
|
|
|
},
|
|
|
|
cli.StringFlag{
|
|
|
|
Name: "secret",
|
|
|
|
Value: "",
|
|
|
|
Usage: "cluster secret (32 byte pnet-key) as needed. Only when using the LibP2P endpoint",
|
2017-01-24 14:06:17 +00:00
|
|
|
},
|
|
|
|
cli.BoolFlag{
|
|
|
|
Name: "https, s",
|
|
|
|
Usage: "use https to connect to the API",
|
|
|
|
},
|
2017-07-21 21:06:10 +00:00
|
|
|
cli.BoolFlag{
|
|
|
|
Name: "no-check-certificate",
|
2017-08-29 01:41:54 +00:00
|
|
|
Usage: "do not verify server TLS certificate. only valid with --https flag",
|
2017-07-21 21:06:10 +00:00
|
|
|
},
|
2017-02-08 18:52:34 +00:00
|
|
|
cli.StringFlag{
|
|
|
|
Name: "encoding, enc",
|
|
|
|
Value: "text",
|
|
|
|
Usage: "output format encoding [text, json]",
|
|
|
|
},
|
2017-01-24 14:06:17 +00:00
|
|
|
cli.IntFlag{
|
|
|
|
Name: "timeout, t",
|
|
|
|
Value: defaultTimeout,
|
|
|
|
Usage: "number of seconds to wait before timing out a request",
|
|
|
|
},
|
|
|
|
cli.BoolFlag{
|
|
|
|
Name: "debug, d",
|
|
|
|
Usage: "set debug log level",
|
|
|
|
},
|
2017-08-29 01:41:54 +00:00
|
|
|
cli.StringFlag{
|
|
|
|
Name: "basic-auth",
|
|
|
|
Usage: `<username>[:<password>] specify BasicAuth credentials for server that
|
|
|
|
requires authorization. implies --https, which you can disable with --force-http`,
|
|
|
|
EnvVar: "CLUSTER_CREDENTIALS",
|
|
|
|
},
|
|
|
|
cli.BoolFlag{
|
|
|
|
Name: "force-http, f",
|
|
|
|
Usage: "force HTTP. only valid when using BasicAuth",
|
|
|
|
},
|
2017-01-24 14:06:17 +00:00
|
|
|
}
|
2016-12-22 16:14:15 +00:00
|
|
|
|
2017-01-24 14:06:17 +00:00
|
|
|
app.Before = func(c *cli.Context) error {
|
2017-12-05 20:44:22 +00:00
|
|
|
cfg := &client.Config{}
|
2018-03-15 16:15:23 +00:00
|
|
|
|
|
|
|
if c.Bool("debug") {
|
|
|
|
logging.SetLogLevel("cluster-ctl", "debug")
|
2020-04-17 11:36:05 +00:00
|
|
|
logging.SetLogLevel("apitypes", "debug")
|
2018-03-15 16:15:23 +00:00
|
|
|
cfg.LogLevel = "debug"
|
|
|
|
logger.Debug("debug level enabled")
|
|
|
|
}
|
|
|
|
|
2017-12-05 20:44:22 +00:00
|
|
|
addr, err := ma.NewMultiaddr(c.String("host"))
|
|
|
|
checkErr("parsing host multiaddress", err)
|
2018-03-15 16:15:23 +00:00
|
|
|
|
2018-08-10 13:10:16 +00:00
|
|
|
cfg.APIAddr = addr
|
|
|
|
if hexSecret := c.String("secret"); hexSecret != "" {
|
|
|
|
secret, err := hex.DecodeString(hexSecret)
|
|
|
|
checkErr("parsing secret", err)
|
|
|
|
cfg.ProtectorKey = secret
|
2018-03-15 16:15:23 +00:00
|
|
|
}
|
2017-12-05 20:44:22 +00:00
|
|
|
|
|
|
|
cfg.Timeout = time.Duration(c.Int("timeout")) * time.Second
|
2018-03-15 16:15:23 +00:00
|
|
|
|
2018-08-10 13:10:16 +00:00
|
|
|
if client.IsPeerAddress(cfg.APIAddr) && c.Bool("https") {
|
2020-03-13 20:40:02 +00:00
|
|
|
logger.Warn("Using libp2p-http. SSL flags will be ignored")
|
2018-03-15 16:15:23 +00:00
|
|
|
}
|
|
|
|
|
2017-12-05 20:44:22 +00:00
|
|
|
cfg.SSL = c.Bool("https")
|
|
|
|
cfg.NoVerifyCert = c.Bool("no-check-certificate")
|
|
|
|
user, pass := parseCredentials(c.String("basic-auth"))
|
|
|
|
cfg.Username = user
|
|
|
|
cfg.Password = pass
|
|
|
|
if user != "" && !cfg.SSL && !c.Bool("force-http") {
|
2020-03-13 20:40:02 +00:00
|
|
|
logger.Warn("SSL automatically enabled with basic auth credentials. Set \"force-http\" to disable")
|
2017-12-05 20:44:22 +00:00
|
|
|
cfg.SSL = true
|
2017-01-24 14:06:17 +00:00
|
|
|
}
|
2017-12-05 20:44:22 +00:00
|
|
|
|
2017-12-07 11:00:28 +00:00
|
|
|
enc := c.String("encoding")
|
|
|
|
if enc != "text" && enc != "json" {
|
|
|
|
checkErr("", errors.New("unsupported encoding"))
|
|
|
|
}
|
|
|
|
|
2018-08-30 23:14:06 +00:00
|
|
|
globalClient, err = client.NewDefaultClient(cfg)
|
2017-12-05 20:44:22 +00:00
|
|
|
checkErr("creating API client", err)
|
2018-06-27 04:03:15 +00:00
|
|
|
|
|
|
|
// TODO: need to figure out best way to configure tracing for ctl
|
|
|
|
// leaving the following as it is still useful for local debugging.
|
|
|
|
// tracingCfg := &observations.Config{}
|
|
|
|
// tracingCfg.Default()
|
|
|
|
// tracingCfg.EnableTracing = true
|
|
|
|
// tracingCfg.TracingServiceName = "cluster-ctl"
|
|
|
|
// tracingCfg.TracingSamplingProb = 1
|
|
|
|
// tracer = observations.SetupTracing(tracingCfg)
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
app.After = func(c *cli.Context) error {
|
|
|
|
// TODO: need to figure out best way to configure tracing for ctl
|
|
|
|
// leaving the following as it is still useful for local debugging.
|
|
|
|
// tracer.Flush()
|
2017-01-24 14:06:17 +00:00
|
|
|
return nil
|
|
|
|
}
|
2016-12-22 16:14:15 +00:00
|
|
|
|
2017-01-24 14:06:17 +00:00
|
|
|
app.Commands = []cli.Command{
|
2017-01-24 15:19:23 +00:00
|
|
|
{
|
|
|
|
Name: "id",
|
2018-07-23 09:14:43 +00:00
|
|
|
Usage: "Retrieve peer information",
|
2017-07-03 16:36:00 +00:00
|
|
|
Description: `
|
|
|
|
This command displays information about the peer that the tool is contacting
|
|
|
|
(usually running in localhost).
|
2017-01-24 15:19:23 +00:00
|
|
|
`,
|
2017-12-05 20:44:22 +00:00
|
|
|
Flags: []cli.Flag{},
|
2017-01-24 18:55:06 +00:00
|
|
|
Action: func(c *cli.Context) error {
|
2018-06-27 04:03:15 +00:00
|
|
|
resp, cerr := globalClient.ID(ctx)
|
2017-12-05 20:44:22 +00:00
|
|
|
formatResponse(c, resp, cerr)
|
2017-01-24 18:55:06 +00:00
|
|
|
return nil
|
2017-01-24 15:19:23 +00:00
|
|
|
},
|
|
|
|
},
|
2017-01-24 14:06:17 +00:00
|
|
|
{
|
2017-07-03 16:36:00 +00:00
|
|
|
Name: "peers",
|
2018-07-23 09:14:43 +00:00
|
|
|
Usage: "List and manage IPFS Cluster peers",
|
|
|
|
Description: "List and manage IPFS Cluster peers",
|
2017-01-24 14:06:17 +00:00
|
|
|
Subcommands: []cli.Command{
|
|
|
|
{
|
|
|
|
Name: "ls",
|
|
|
|
Usage: "list the nodes participating in the IPFS Cluster",
|
2017-07-03 16:36:00 +00:00
|
|
|
Description: `
|
|
|
|
This command provides a list of the ID information of all the peers in the Cluster.
|
2017-01-30 12:12:25 +00:00
|
|
|
`,
|
2017-12-05 20:44:22 +00:00
|
|
|
Flags: []cli.Flag{},
|
2017-07-03 16:36:00 +00:00
|
|
|
ArgsUsage: " ",
|
2017-01-30 12:12:25 +00:00
|
|
|
Action: func(c *cli.Context) error {
|
2018-06-27 04:03:15 +00:00
|
|
|
resp, cerr := globalClient.Peers(ctx)
|
2017-12-05 20:44:22 +00:00
|
|
|
formatResponse(c, resp, cerr)
|
2017-01-30 12:12:25 +00:00
|
|
|
return nil
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "rm",
|
|
|
|
Usage: "remove a peer from the Cluster",
|
2017-07-03 16:36:00 +00:00
|
|
|
Description: `
|
2017-01-30 12:12:25 +00:00
|
|
|
This command removes a peer from the cluster. If the peer is online, it will
|
|
|
|
automatically shut down. All other cluster peers should be online for the
|
|
|
|
operation to succeed, otherwise some nodes may be left with an outdated list of
|
|
|
|
cluster peers.
|
|
|
|
`,
|
|
|
|
ArgsUsage: "<peer ID>",
|
2017-12-05 20:44:22 +00:00
|
|
|
Flags: []cli.Flag{},
|
2017-01-24 18:55:06 +00:00
|
|
|
Action: func(c *cli.Context) error {
|
2017-01-30 12:12:25 +00:00
|
|
|
pid := c.Args().First()
|
2020-04-14 17:58:00 +00:00
|
|
|
p, err := peer.Decode(pid)
|
2017-01-30 12:12:25 +00:00
|
|
|
checkErr("parsing peer ID", err)
|
2018-06-27 04:03:15 +00:00
|
|
|
cerr := globalClient.PeerRm(ctx, p)
|
2017-12-05 20:44:22 +00:00
|
|
|
formatResponse(c, nil, cerr)
|
2017-01-24 18:55:06 +00:00
|
|
|
return nil
|
2017-01-24 14:06:17 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2018-07-23 09:14:43 +00:00
|
|
|
{
|
|
|
|
Name: "add",
|
|
|
|
Usage: "Add a file or directory to ipfs and pin it in the cluster",
|
|
|
|
ArgsUsage: "<path>",
|
|
|
|
Description: `
|
2018-08-08 19:11:26 +00:00
|
|
|
Add allows to add and replicate content to several ipfs daemons, performing
|
2018-08-19 17:39:08 +00:00
|
|
|
a Cluster Pin operation on success. It takes elements from local paths as
|
|
|
|
well as from web URLs (accessed with a GET request). Providing several
|
|
|
|
arguments will automatically set --wrap-in-directory.
|
2018-07-23 09:14:43 +00:00
|
|
|
|
|
|
|
Cluster Add is equivalent to "ipfs add" in terms of DAG building, and supports
|
2018-08-19 17:39:08 +00:00
|
|
|
the same options for adjusting the chunker, the DAG layout etc. However,
|
|
|
|
it will allocate the content and send it directly to the allocated peers (among
|
|
|
|
which may not necessarily be the local ipfs daemon).
|
|
|
|
|
|
|
|
Once the adding process is finished, the content is fully added to all
|
|
|
|
allocations and pinned in them. This makes cluster add slower than a local
|
|
|
|
ipfs add, but the result is a fully replicated CID on completion.
|
2019-09-21 08:37:26 +00:00
|
|
|
If you prefer faster adding, use the --local flag to add directly to the local
|
|
|
|
IPFS node and pin in the destinations after that. Note that the local IPFS
|
|
|
|
node may not be among the destinations, which will leave the unpinned content
|
|
|
|
in it.
|
2018-08-19 17:39:08 +00:00
|
|
|
|
2019-08-30 11:26:52 +00:00
|
|
|
Optional replication-min and replication-max factors can be provided: -1 means
|
|
|
|
"pin everywhere" and 0 means use cluster's default setting (i.e., replication
|
|
|
|
factor set in config). Positive values indicate how many peers should pin this
|
|
|
|
content.
|
2018-07-23 09:14:43 +00:00
|
|
|
`,
|
2018-08-19 17:39:08 +00:00
|
|
|
/*
|
|
|
|
Cluster Add supports handling huge files and sharding the resulting DAG among
|
|
|
|
several ipfs daemons (--shard). In this case, a single ipfs daemon will not
|
|
|
|
contain the full dag, but only parts of it (shards). Desired shard size can
|
|
|
|
be provided with the --shard-size flag.
|
|
|
|
|
|
|
|
We recommend setting a --name for sharded pins. Otherwise, it will be
|
|
|
|
automatically generated.
|
|
|
|
*/
|
2018-07-23 09:14:43 +00:00
|
|
|
Flags: []cli.Flag{
|
|
|
|
cli.BoolFlag{
|
|
|
|
Name: "recursive, r",
|
|
|
|
Usage: "Add directory paths recursively",
|
|
|
|
},
|
2018-08-08 19:11:26 +00:00
|
|
|
cli.BoolFlag{
|
|
|
|
Name: "quiet, q",
|
|
|
|
Usage: "Write only hashes to output (one per line)",
|
|
|
|
},
|
|
|
|
cli.BoolFlag{
|
|
|
|
Name: "quieter, Q",
|
|
|
|
Usage: "Write only final hash to output",
|
|
|
|
},
|
Fix #632: Add --no-stream to ipfs-cluster-ctl
tl;dr: this solves the user's immediate need and, even if not tne strictest
solution, it is the simplest one.
I think we should not have the server buffer output when we can do it rather
easily client side and have the clients use their own memory for the task even
if `stream-channels=false` would do this.
We can always change the approach, but this is the minimal solution to
json array with all the AddedOutput things.
We might not buffer at all and hack a `[`, `,` separating elements and `]`
at the end, when json encoding is enabled, etc. But that would not be clean,
specially if we mean to support more output formats at some point.
Enabling supporting stream-channels=false in the api/rest/client means adding
new methods, with tests, modifying the interface etc etc. for what is
essentially a presentation issue in "ctl" in the end. Similarly we could
buffer inside the client, but it is so trivial that I don't see advatange.
We should also start thinking about moving to streaming API endpoints and
when that moment arrives we shall revisit this discussion.
I have removed the hacky manual output parts by declaring a custom
addedOutputQuiet type which wraps added output and is understood by
the formatters.go helpers.
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2019-01-09 17:53:22 +00:00
|
|
|
cli.BoolFlag{
|
|
|
|
Name: "no-stream",
|
2019-01-10 10:13:21 +00:00
|
|
|
Usage: "Buffer output locally. Produces a valid JSON array with --enc=json.",
|
Fix #632: Add --no-stream to ipfs-cluster-ctl
tl;dr: this solves the user's immediate need and, even if not tne strictest
solution, it is the simplest one.
I think we should not have the server buffer output when we can do it rather
easily client side and have the clients use their own memory for the task even
if `stream-channels=false` would do this.
We can always change the approach, but this is the minimal solution to
json array with all the AddedOutput things.
We might not buffer at all and hack a `[`, `,` separating elements and `]`
at the end, when json encoding is enabled, etc. But that would not be clean,
specially if we mean to support more output formats at some point.
Enabling supporting stream-channels=false in the api/rest/client means adding
new methods, with tests, modifying the interface etc etc. for what is
essentially a presentation issue in "ctl" in the end. Similarly we could
buffer inside the client, but it is so trivial that I don't see advatange.
We should also start thinking about moving to streaming API endpoints and
when that moment arrives we shall revisit this discussion.
I have removed the hacky manual output parts by declaring a custom
addedOutputQuiet type which wraps added output and is understood by
the formatters.go helpers.
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2019-01-09 17:53:22 +00:00
|
|
|
},
|
2018-08-08 19:11:26 +00:00
|
|
|
cli.StringFlag{
|
|
|
|
Name: "layout",
|
|
|
|
Value: defaultAddParams.Layout,
|
|
|
|
Usage: "Dag layout to use for dag generation: balanced or trickle",
|
|
|
|
},
|
2018-08-08 23:16:30 +00:00
|
|
|
cli.BoolFlag{
|
|
|
|
Name: "wrap-with-directory, w",
|
2019-09-06 13:17:05 +00:00
|
|
|
Usage: "Wrap a with a directory object",
|
2018-08-08 23:16:30 +00:00
|
|
|
},
|
2018-08-08 19:11:26 +00:00
|
|
|
cli.BoolFlag{
|
|
|
|
Name: "hidden, H",
|
|
|
|
Usage: "Include files that are hidden. Only takes effect on recursive add",
|
|
|
|
},
|
|
|
|
cli.StringFlag{
|
|
|
|
Name: "chunker, s",
|
|
|
|
Usage: "'size-<size>' or 'rabin-<min>-<avg>-<max>'",
|
|
|
|
Value: defaultAddParams.Chunker,
|
|
|
|
},
|
|
|
|
cli.BoolFlag{
|
|
|
|
Name: "raw-leaves",
|
|
|
|
Usage: "Use raw blocks for leaves (experimental)",
|
|
|
|
},
|
2018-08-20 14:25:26 +00:00
|
|
|
cli.IntFlag{
|
|
|
|
Name: "cid-version",
|
|
|
|
Usage: "CID version. Non default implies raw-leaves",
|
|
|
|
Value: defaultAddParams.CidVersion,
|
|
|
|
},
|
|
|
|
cli.StringFlag{
|
|
|
|
Name: "hash",
|
2019-09-06 13:17:05 +00:00
|
|
|
Usage: "Hash function to use. Implies cid-version=1",
|
2018-08-20 14:25:26 +00:00
|
|
|
Value: defaultAddParams.HashFun,
|
|
|
|
},
|
2019-08-28 13:09:30 +00:00
|
|
|
cli.BoolFlag{
|
|
|
|
Name: "local",
|
2019-09-21 08:37:26 +00:00
|
|
|
Usage: "Add to local peer but pin normally",
|
2019-08-28 13:09:30 +00:00
|
|
|
},
|
2018-07-23 09:14:43 +00:00
|
|
|
cli.StringFlag{
|
|
|
|
Name: "name, n",
|
2018-08-06 10:44:44 +00:00
|
|
|
Value: defaultAddParams.Name,
|
2018-07-23 09:14:43 +00:00
|
|
|
Usage: "Sets a name for this pin",
|
|
|
|
},
|
|
|
|
cli.IntFlag{
|
|
|
|
Name: "replication-min, rmin",
|
2018-08-06 10:44:44 +00:00
|
|
|
Value: defaultAddParams.ReplicationFactorMin,
|
2018-07-23 09:14:43 +00:00
|
|
|
Usage: "Sets the minimum replication factor for pinning this file",
|
|
|
|
},
|
|
|
|
cli.IntFlag{
|
|
|
|
Name: "replication-max, rmax",
|
2018-08-06 10:44:44 +00:00
|
|
|
Value: defaultAddParams.ReplicationFactorMax,
|
2018-07-23 09:14:43 +00:00
|
|
|
Usage: "Sets the maximum replication factor for pinning this file",
|
|
|
|
},
|
2019-09-18 16:05:55 +00:00
|
|
|
cli.StringFlag{
|
|
|
|
Name: "expire-in",
|
2019-11-05 09:11:50 +00:00
|
|
|
Usage: "Duration after which the pin should be unpinned automatically",
|
2019-09-18 16:05:55 +00:00
|
|
|
},
|
2019-08-19 04:52:50 +00:00
|
|
|
cli.StringSliceFlag{
|
|
|
|
Name: "metadata",
|
2019-08-26 09:00:45 +00:00
|
|
|
Usage: "Pin metadata: key=value. Can be added multiple times",
|
2019-08-19 04:52:50 +00:00
|
|
|
},
|
2019-08-11 18:08:54 +00:00
|
|
|
cli.StringFlag{
|
|
|
|
Name: "allocations, allocs",
|
|
|
|
Usage: "Optional comma-separated list of peer IDs",
|
|
|
|
},
|
2019-03-23 13:47:45 +00:00
|
|
|
cli.BoolFlag{
|
|
|
|
Name: "nocopy",
|
|
|
|
Usage: "Add the URL using filestore. Implies raw-leaves. (experimental)",
|
|
|
|
},
|
2018-08-08 19:11:26 +00:00
|
|
|
// TODO: Uncomment when sharding is supported.
|
2018-07-23 09:14:43 +00:00
|
|
|
// cli.BoolFlag{
|
2018-08-08 19:11:26 +00:00
|
|
|
// Name: "shard",
|
|
|
|
// Usage: "Break the file into pieces (shards) and distributed among peers",
|
2018-07-23 09:14:43 +00:00
|
|
|
// },
|
2018-08-08 19:11:26 +00:00
|
|
|
// cli.Uint64Flag{
|
|
|
|
// Name: "shard-size",
|
|
|
|
// Value: defaultAddParams.ShardSize,
|
|
|
|
// Usage: "Sets the maximum replication factor for pinning this file",
|
|
|
|
// },
|
|
|
|
// TODO: Figure progress over total bar.
|
2018-07-23 09:14:43 +00:00
|
|
|
// cli.BoolFlag{
|
2018-08-08 19:11:26 +00:00
|
|
|
// Name: "progress, p",
|
|
|
|
// Usage: "Stream progress data",
|
2018-07-23 09:14:43 +00:00
|
|
|
// },
|
2018-08-08 19:11:26 +00:00
|
|
|
|
2018-07-23 09:14:43 +00:00
|
|
|
},
|
|
|
|
Action: func(c *cli.Context) error {
|
|
|
|
shard := c.Bool("shard")
|
|
|
|
name := c.String("name")
|
|
|
|
if shard && name == "" {
|
2019-03-08 02:13:37 +00:00
|
|
|
randName, err := uuid.NewRandom()
|
2018-07-23 09:14:43 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
// take only first letters
|
|
|
|
name = "sharded-" + strings.Split(randName.String(), "-")[0]
|
|
|
|
}
|
|
|
|
|
2018-08-19 17:39:08 +00:00
|
|
|
// Read arguments (paths)
|
2020-04-14 17:58:00 +00:00
|
|
|
paths := make([]string, c.NArg())
|
2018-07-23 09:14:43 +00:00
|
|
|
for i, path := range c.Args() {
|
|
|
|
paths[i] = path
|
|
|
|
}
|
|
|
|
|
|
|
|
if len(paths) == 0 {
|
|
|
|
checkErr("", errors.New("need at least one path"))
|
|
|
|
}
|
|
|
|
|
2018-08-19 17:39:08 +00:00
|
|
|
// Setup AddParams
|
2018-08-06 10:44:44 +00:00
|
|
|
p := api.DefaultAddParams()
|
|
|
|
p.ReplicationFactorMin = c.Int("replication-min")
|
|
|
|
p.ReplicationFactorMax = c.Int("replication-max")
|
2019-09-18 16:05:55 +00:00
|
|
|
if expireIn := c.String("expire-in"); expireIn != "" {
|
|
|
|
d, err := time.ParseDuration(expireIn)
|
|
|
|
checkErr("parsing expire-in", err)
|
|
|
|
p.ExpireAt = time.Now().Add(d)
|
|
|
|
}
|
|
|
|
|
2019-08-26 09:00:45 +00:00
|
|
|
p.Metadata = parseMetadata(c.StringSlice("metadata"))
|
2018-08-06 10:44:44 +00:00
|
|
|
p.Name = name
|
2019-08-11 18:08:54 +00:00
|
|
|
if c.String("allocations") != "" {
|
|
|
|
p.UserAllocations = api.StringsToPeers(strings.Split(c.String("allocations"), ","))
|
|
|
|
}
|
2018-08-08 19:11:26 +00:00
|
|
|
//p.Shard = shard
|
|
|
|
//p.ShardSize = c.Uint64("shard-size")
|
|
|
|
p.Shard = false
|
2018-08-19 17:39:08 +00:00
|
|
|
p.Recursive = c.Bool("recursive")
|
2019-08-28 13:09:30 +00:00
|
|
|
p.Local = c.Bool("local")
|
2018-08-06 10:44:44 +00:00
|
|
|
p.Layout = c.String("layout")
|
|
|
|
p.Chunker = c.String("chunker")
|
|
|
|
p.RawLeaves = c.Bool("raw-leaves")
|
|
|
|
p.Hidden = c.Bool("hidden")
|
2018-08-08 23:16:30 +00:00
|
|
|
p.Wrap = c.Bool("wrap-with-directory") || len(paths) > 1
|
2018-08-20 14:25:26 +00:00
|
|
|
p.CidVersion = c.Int("cid-version")
|
|
|
|
p.HashFun = c.String("hash")
|
|
|
|
if p.HashFun != defaultAddParams.HashFun {
|
|
|
|
p.CidVersion = 1
|
|
|
|
}
|
|
|
|
if p.CidVersion > 0 {
|
|
|
|
p.RawLeaves = true
|
|
|
|
}
|
2019-03-23 13:47:45 +00:00
|
|
|
p.NoCopy = c.Bool("nocopy")
|
|
|
|
if p.NoCopy {
|
|
|
|
p.RawLeaves = true
|
|
|
|
}
|
2018-08-06 20:49:28 +00:00
|
|
|
|
|
|
|
out := make(chan *api.AddedOutput, 1)
|
2018-08-08 19:11:26 +00:00
|
|
|
var wg sync.WaitGroup
|
|
|
|
wg.Add(1)
|
2018-08-06 20:49:28 +00:00
|
|
|
go func() {
|
2018-08-08 19:11:26 +00:00
|
|
|
defer wg.Done()
|
Fix #632: Add --no-stream to ipfs-cluster-ctl
tl;dr: this solves the user's immediate need and, even if not tne strictest
solution, it is the simplest one.
I think we should not have the server buffer output when we can do it rather
easily client side and have the clients use their own memory for the task even
if `stream-channels=false` would do this.
We can always change the approach, but this is the minimal solution to
json array with all the AddedOutput things.
We might not buffer at all and hack a `[`, `,` separating elements and `]`
at the end, when json encoding is enabled, etc. But that would not be clean,
specially if we mean to support more output formats at some point.
Enabling supporting stream-channels=false in the api/rest/client means adding
new methods, with tests, modifying the interface etc etc. for what is
essentially a presentation issue in "ctl" in the end. Similarly we could
buffer inside the client, but it is so trivial that I don't see advatange.
We should also start thinking about moving to streaming API endpoints and
when that moment arrives we shall revisit this discussion.
I have removed the hacky manual output parts by declaring a custom
addedOutputQuiet type which wraps added output and is understood by
the formatters.go helpers.
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2019-01-09 17:53:22 +00:00
|
|
|
|
2019-02-27 17:04:35 +00:00
|
|
|
var buffered []*addedOutputQuiet
|
2019-03-23 13:59:16 +00:00
|
|
|
var lastBuf *addedOutputQuiet
|
Fix #632: Add --no-stream to ipfs-cluster-ctl
tl;dr: this solves the user's immediate need and, even if not tne strictest
solution, it is the simplest one.
I think we should not have the server buffer output when we can do it rather
easily client side and have the clients use their own memory for the task even
if `stream-channels=false` would do this.
We can always change the approach, but this is the minimal solution to
json array with all the AddedOutput things.
We might not buffer at all and hack a `[`, `,` separating elements and `]`
at the end, when json encoding is enabled, etc. But that would not be clean,
specially if we mean to support more output formats at some point.
Enabling supporting stream-channels=false in the api/rest/client means adding
new methods, with tests, modifying the interface etc etc. for what is
essentially a presentation issue in "ctl" in the end. Similarly we could
buffer inside the client, but it is so trivial that I don't see advatange.
We should also start thinking about moving to streaming API endpoints and
when that moment arrives we shall revisit this discussion.
I have removed the hacky manual output parts by declaring a custom
addedOutputQuiet type which wraps added output and is understood by
the formatters.go helpers.
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2019-01-09 17:53:22 +00:00
|
|
|
var qq = c.Bool("quieter")
|
|
|
|
var q = c.Bool("quiet") || qq
|
2019-01-10 10:13:21 +00:00
|
|
|
var bufferResults = c.Bool("no-stream")
|
2018-08-06 20:49:28 +00:00
|
|
|
for v := range out {
|
2019-03-23 16:31:05 +00:00
|
|
|
added := &addedOutputQuiet{
|
|
|
|
AddedOutput: v,
|
|
|
|
quiet: q,
|
|
|
|
}
|
2019-03-23 13:59:16 +00:00
|
|
|
lastBuf = added
|
Fix #632: Add --no-stream to ipfs-cluster-ctl
tl;dr: this solves the user's immediate need and, even if not tne strictest
solution, it is the simplest one.
I think we should not have the server buffer output when we can do it rather
easily client side and have the clients use their own memory for the task even
if `stream-channels=false` would do this.
We can always change the approach, but this is the minimal solution to
json array with all the AddedOutput things.
We might not buffer at all and hack a `[`, `,` separating elements and `]`
at the end, when json encoding is enabled, etc. But that would not be clean,
specially if we mean to support more output formats at some point.
Enabling supporting stream-channels=false in the api/rest/client means adding
new methods, with tests, modifying the interface etc etc. for what is
essentially a presentation issue in "ctl" in the end. Similarly we could
buffer inside the client, but it is so trivial that I don't see advatange.
We should also start thinking about moving to streaming API endpoints and
when that moment arrives we shall revisit this discussion.
I have removed the hacky manual output parts by declaring a custom
addedOutputQuiet type which wraps added output and is understood by
the formatters.go helpers.
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2019-01-09 17:53:22 +00:00
|
|
|
if bufferResults {
|
|
|
|
buffered = append(buffered, added)
|
2018-08-08 19:11:26 +00:00
|
|
|
continue
|
|
|
|
}
|
Fix #632: Add --no-stream to ipfs-cluster-ctl
tl;dr: this solves the user's immediate need and, even if not tne strictest
solution, it is the simplest one.
I think we should not have the server buffer output when we can do it rather
easily client side and have the clients use their own memory for the task even
if `stream-channels=false` would do this.
We can always change the approach, but this is the minimal solution to
json array with all the AddedOutput things.
We might not buffer at all and hack a `[`, `,` separating elements and `]`
at the end, when json encoding is enabled, etc. But that would not be clean,
specially if we mean to support more output formats at some point.
Enabling supporting stream-channels=false in the api/rest/client means adding
new methods, with tests, modifying the interface etc etc. for what is
essentially a presentation issue in "ctl" in the end. Similarly we could
buffer inside the client, but it is so trivial that I don't see advatange.
We should also start thinking about moving to streaming API endpoints and
when that moment arrives we shall revisit this discussion.
I have removed the hacky manual output parts by declaring a custom
addedOutputQuiet type which wraps added output and is understood by
the formatters.go helpers.
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2019-01-09 17:53:22 +00:00
|
|
|
if !qq { // print things
|
|
|
|
formatResponse(c, added, nil)
|
2018-08-08 19:11:26 +00:00
|
|
|
}
|
|
|
|
}
|
2019-03-23 16:31:05 +00:00
|
|
|
if lastBuf == nil || lastBuf.AddedOutput == nil {
|
Fix #632: Add --no-stream to ipfs-cluster-ctl
tl;dr: this solves the user's immediate need and, even if not tne strictest
solution, it is the simplest one.
I think we should not have the server buffer output when we can do it rather
easily client side and have the clients use their own memory for the task even
if `stream-channels=false` would do this.
We can always change the approach, but this is the minimal solution to
json array with all the AddedOutput things.
We might not buffer at all and hack a `[`, `,` separating elements and `]`
at the end, when json encoding is enabled, etc. But that would not be clean,
specially if we mean to support more output formats at some point.
Enabling supporting stream-channels=false in the api/rest/client means adding
new methods, with tests, modifying the interface etc etc. for what is
essentially a presentation issue in "ctl" in the end. Similarly we could
buffer inside the client, but it is so trivial that I don't see advatange.
We should also start thinking about moving to streaming API endpoints and
when that moment arrives we shall revisit this discussion.
I have removed the hacky manual output parts by declaring a custom
addedOutputQuiet type which wraps added output and is understood by
the formatters.go helpers.
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2019-01-09 17:53:22 +00:00
|
|
|
return // no elements at all
|
|
|
|
}
|
|
|
|
if bufferResults { // we buffered.
|
|
|
|
if qq { // [last elem]
|
2019-03-23 13:59:16 +00:00
|
|
|
formatResponse(c, []*addedOutputQuiet{lastBuf}, nil)
|
Fix #632: Add --no-stream to ipfs-cluster-ctl
tl;dr: this solves the user's immediate need and, even if not tne strictest
solution, it is the simplest one.
I think we should not have the server buffer output when we can do it rather
easily client side and have the clients use their own memory for the task even
if `stream-channels=false` would do this.
We can always change the approach, but this is the minimal solution to
json array with all the AddedOutput things.
We might not buffer at all and hack a `[`, `,` separating elements and `]`
at the end, when json encoding is enabled, etc. But that would not be clean,
specially if we mean to support more output formats at some point.
Enabling supporting stream-channels=false in the api/rest/client means adding
new methods, with tests, modifying the interface etc etc. for what is
essentially a presentation issue in "ctl" in the end. Similarly we could
buffer inside the client, but it is so trivial that I don't see advatange.
We should also start thinking about moving to streaming API endpoints and
when that moment arrives we shall revisit this discussion.
I have removed the hacky manual output parts by declaring a custom
addedOutputQuiet type which wraps added output and is understood by
the formatters.go helpers.
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2019-01-09 17:53:22 +00:00
|
|
|
return
|
2019-01-04 18:31:32 +00:00
|
|
|
}
|
Fix #632: Add --no-stream to ipfs-cluster-ctl
tl;dr: this solves the user's immediate need and, even if not tne strictest
solution, it is the simplest one.
I think we should not have the server buffer output when we can do it rather
easily client side and have the clients use their own memory for the task even
if `stream-channels=false` would do this.
We can always change the approach, but this is the minimal solution to
json array with all the AddedOutput things.
We might not buffer at all and hack a `[`, `,` separating elements and `]`
at the end, when json encoding is enabled, etc. But that would not be clean,
specially if we mean to support more output formats at some point.
Enabling supporting stream-channels=false in the api/rest/client means adding
new methods, with tests, modifying the interface etc etc. for what is
essentially a presentation issue in "ctl" in the end. Similarly we could
buffer inside the client, but it is so trivial that I don't see advatange.
We should also start thinking about moving to streaming API endpoints and
when that moment arrives we shall revisit this discussion.
I have removed the hacky manual output parts by declaring a custom
addedOutputQuiet type which wraps added output and is understood by
the formatters.go helpers.
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2019-01-09 17:53:22 +00:00
|
|
|
// [all elems]
|
|
|
|
formatResponse(c, buffered, nil)
|
|
|
|
} else if qq { // we already printed unless Quieter
|
2019-03-23 13:59:16 +00:00
|
|
|
formatResponse(c, lastBuf, nil)
|
Fix #632: Add --no-stream to ipfs-cluster-ctl
tl;dr: this solves the user's immediate need and, even if not tne strictest
solution, it is the simplest one.
I think we should not have the server buffer output when we can do it rather
easily client side and have the clients use their own memory for the task even
if `stream-channels=false` would do this.
We can always change the approach, but this is the minimal solution to
json array with all the AddedOutput things.
We might not buffer at all and hack a `[`, `,` separating elements and `]`
at the end, when json encoding is enabled, etc. But that would not be clean,
specially if we mean to support more output formats at some point.
Enabling supporting stream-channels=false in the api/rest/client means adding
new methods, with tests, modifying the interface etc etc. for what is
essentially a presentation issue in "ctl" in the end. Similarly we could
buffer inside the client, but it is so trivial that I don't see advatange.
We should also start thinking about moving to streaming API endpoints and
when that moment arrives we shall revisit this discussion.
I have removed the hacky manual output parts by declaring a custom
addedOutputQuiet type which wraps added output and is understood by
the formatters.go helpers.
License: MIT
Signed-off-by: Hector Sanjuan <code@hector.link>
2019-01-09 17:53:22 +00:00
|
|
|
return
|
2018-08-06 20:49:28 +00:00
|
|
|
}
|
|
|
|
}()
|
|
|
|
|
2018-06-27 04:03:15 +00:00
|
|
|
cerr := globalClient.Add(ctx, paths, p, out)
|
2018-08-08 19:11:26 +00:00
|
|
|
wg.Wait()
|
2018-07-23 09:14:43 +00:00
|
|
|
formatResponse(c, nil, cerr)
|
2018-08-08 19:11:26 +00:00
|
|
|
return cerr
|
2018-07-23 09:14:43 +00:00
|
|
|
},
|
|
|
|
},
|
2017-01-24 14:06:17 +00:00
|
|
|
{
|
2017-07-03 16:36:00 +00:00
|
|
|
Name: "pin",
|
2018-07-23 09:14:43 +00:00
|
|
|
Usage: "Pin and unpin and list items in IPFS Cluster",
|
|
|
|
Description: "Pin and unpin and list items in IPFS Cluster",
|
2017-01-24 14:06:17 +00:00
|
|
|
Subcommands: []cli.Command{
|
|
|
|
{
|
|
|
|
Name: "add",
|
2019-07-12 14:40:29 +00:00
|
|
|
Usage: "Pin an item in the cluster",
|
2017-07-03 16:36:00 +00:00
|
|
|
Description: `
|
2016-12-22 16:14:15 +00:00
|
|
|
This command tells IPFS Cluster to start managing a CID. Depending on
|
|
|
|
the pinning strategy, this will trigger IPFS pin requests. The CID will
|
|
|
|
become part of the Cluster's state and will tracked from this point.
|
|
|
|
|
2017-01-24 14:06:17 +00:00
|
|
|
When the request has succeeded, the command returns the status of the CID
|
|
|
|
in the cluster and should be part of the list offered by "pin ls".
|
2017-03-08 17:51:03 +00:00
|
|
|
|
|
|
|
An optional replication factor can be provided: -1 means "pin everywhere"
|
2019-08-30 11:26:52 +00:00
|
|
|
and 0 means use cluster's default setting (i.e., replication factor set in
|
|
|
|
config). Positive values indicate how many peers should pin this content.
|
2019-02-25 11:40:16 +00:00
|
|
|
|
|
|
|
An optional allocations argument can be provided, allocations should be a
|
|
|
|
comma-separated list of peer IDs on which we want to pin. Peers in allocations
|
|
|
|
are prioritized over automatically-determined ones, but replication factors
|
|
|
|
would stil be respected.
|
2017-01-24 14:06:17 +00:00
|
|
|
`,
|
2019-07-12 14:40:29 +00:00
|
|
|
ArgsUsage: "<CID|Path>",
|
2017-03-08 17:51:03 +00:00
|
|
|
Flags: []cli.Flag{
|
|
|
|
cli.IntFlag{
|
|
|
|
Name: "replication, r",
|
|
|
|
Value: 0,
|
2018-01-15 18:32:54 +00:00
|
|
|
Usage: "Sets a custom replication factor (overrides -rmax and -rmin)",
|
|
|
|
},
|
|
|
|
cli.IntFlag{
|
|
|
|
Name: "replication-min, rmin",
|
|
|
|
Value: 0,
|
|
|
|
Usage: "Sets the minimum replication factor for this pin",
|
|
|
|
},
|
|
|
|
cli.IntFlag{
|
|
|
|
Name: "replication-max, rmax",
|
|
|
|
Value: 0,
|
|
|
|
Usage: "Sets the maximum replication factor for this pin",
|
2017-03-08 17:51:03 +00:00
|
|
|
},
|
2019-08-11 08:17:17 +00:00
|
|
|
cli.StringFlag{
|
2019-02-25 11:40:16 +00:00
|
|
|
Name: "allocations, allocs",
|
|
|
|
Usage: "Optional comma-separated list of peer IDs",
|
|
|
|
},
|
2017-11-28 20:06:12 +00:00
|
|
|
cli.StringFlag{
|
|
|
|
Name: "name, n",
|
|
|
|
Value: "",
|
|
|
|
Usage: "Sets a name for this pin",
|
|
|
|
},
|
2020-04-17 11:36:05 +00:00
|
|
|
cli.StringFlag{
|
|
|
|
Name: "mode",
|
|
|
|
Value: "recursive",
|
|
|
|
Usage: "Select a way to pin: recursive or direct",
|
|
|
|
},
|
2019-09-18 16:05:55 +00:00
|
|
|
cli.StringFlag{
|
|
|
|
Name: "expire-in",
|
|
|
|
Usage: "Duration after which pin should be unpinned automatically",
|
|
|
|
},
|
2019-08-19 04:52:50 +00:00
|
|
|
cli.StringSliceFlag{
|
|
|
|
Name: "metadata",
|
2019-08-26 09:00:45 +00:00
|
|
|
Usage: "Pin metadata: key=value. Can be added multiple times",
|
2019-08-19 04:52:50 +00:00
|
|
|
},
|
2018-03-06 07:00:05 +00:00
|
|
|
cli.BoolFlag{
|
|
|
|
Name: "no-status, ns",
|
|
|
|
Usage: "Prevents fetching pin status after pinning (faster, quieter)",
|
|
|
|
},
|
2018-03-14 08:49:49 +00:00
|
|
|
cli.BoolFlag{
|
|
|
|
Name: "wait, w",
|
|
|
|
Usage: "Wait for all nodes to report a status of pinned before returning",
|
|
|
|
},
|
|
|
|
cli.DurationFlag{
|
|
|
|
Name: "wait-timeout, wt",
|
|
|
|
Value: 0,
|
|
|
|
Usage: "How long to --wait (in seconds), default is indefinitely",
|
|
|
|
},
|
2017-03-08 17:51:03 +00:00
|
|
|
},
|
2017-01-24 18:55:06 +00:00
|
|
|
Action: func(c *cli.Context) error {
|
Add PinPath/UnpinPath support.
Squashed commit of the following:
commit 38cf569c6aed77c46ee4e0f8baa4d1a9daf8f03e
Merge: d125f69 aaada42
Author: Hector Sanjuan <hsanjuan@users.noreply.github.com>
Date: Wed Feb 20 11:02:00 2019 +0000
Merge pull request #634 from ipfs/issue_450
Support PinPath, UnpinPath (resolve before pinning)
commit aaada42054e1f1c7b2abb1270859d0de41a0e5d8
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Feb 19 22:16:25 2019 +0530
formatResponse accepts api.Pin and not api.PinSerial
commit b5da4bea045865814cc422da71827b44ddd44b90
Merge: ba59036 cc8dd7e
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Feb 19 21:36:46 2019 +0530
Merge branch 'master' into issue_450
commit ba5903649c1df1dba20f4d6f7e3573d6fe24921f
Merge: f002914 d59880c
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Mon Feb 18 08:41:11 2019 +0530
Merge branch 'issue_450' of github.com:ipfs/ipfs-cluster into issue_450
commit f00291494c0c02621c2296cbb7ac71e4c23aa9ec
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Mon Feb 18 08:31:39 2019 +0530
PinPath: more improvements
Added tracing for new methods
commit d59880c338eaa8214fe06b4f930a540793d78407
Merge: 0ca4c7c b4f0eb3
Author: Hector Sanjuan <hsanjuan@users.noreply.github.com>
Date: Wed Feb 13 15:22:49 2019 +0000
Merge branch 'master' into issue_450
commit 0ca4c7c3b0670ed9c8279f8274d36e3485c10030
Merge: d35017a ecef9ea
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Feb 12 13:10:13 2019 +0530
Merge branch 'master' into issue_450
commit d35017a8de91ca9fc9a9a047c48c75134cee9f98
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Feb 12 13:07:25 2019 +0530
PinPath: more improvements
- Worth having `PinOptions` as a separate field in the struct and
constructing the query in the test with ToQuery()
- sharness: "intialization" line can be placed outside the tests at
the top
commit 68e3b90417ffbad89d41a70ac81d85f9037f8848
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Sun Feb 10 21:43:50 2019 +0530
Using if-continue pattern instead of if-else
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 3c29799f3b85be328b27508332ab92049d8b82f3
Merge: 956790b 4324889
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Thu Feb 7 10:25:52 2019 +0530
Merge branch 'master' into issue_450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 956790b381db9858e4194f983e898b07dc51ba66
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Feb 6 21:11:20 2019 +0530
Removing resolved path
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 7191cc46cedfbec116a9746937e28881b50ca044
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Feb 6 16:45:07 2019 +0530
Fix go vet
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit f8b3d5b63b1b7569e2a3e0d82894fd4491c246c4
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Feb 6 16:07:03 2019 +0530
Fixed linting error
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 23c57eb467755a1f21387a1615a7f34e97348053
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Feb 6 09:20:41 2019 +0530
Fixed tests
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 0caedd94aefeb3b6649dedc214cb4b849ace2ea4
Merge: 17e555e 5a7ee1d
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Feb 6 00:07:10 2019 +0530
Merge branch 'master' into issue_450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 17e555e4a7c574413df90aac70c5cc29cab98f54
Author: Hector Sanjuan <code@hector.link>
Date: Tue Feb 5 16:58:50 2019 +0000
PinPath: address some feedback + improvements
* Changed client's Pin() API and PinPath to be consistent
* Added helper methods to turn PinPath to query and back
* Make code and tests build
* Use TestCidResolved everywhere
* Fix cluster.PinPath arguments
* Fix formatting of responses with --no-status
* Make tests readable and call Fatal when needed
* Use a pathTestCases variable
commit f0e7369c47c5ddadc8ed45df5fd2d4d9b2d42b38
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Feb 5 18:34:26 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
Addressed review comments as in
https://github.com/ipfs/ipfs-cluster/pull/634#pullrequestreview-198751932
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit a8b4f181d2d7afed32ee41331dfaab19fd66a173
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Jan 29 22:41:27 2019 +0530
Fixing tests
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit e39b95ca19e4d75506f4f492678245ef13936a44
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Jan 29 14:52:53 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
- PinPath and UnpinPath should return api.Pin
- PinPath should accept pin options
- Removing duplicate logic for Resolve from cluster
- And many other review comments https://github.com/ipfs/ipfs-cluster/pull/634#pullrequestreview-195509504
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit d146075126320896665ba58d337a13789f68ea86
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Jan 23 17:08:41 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
PinPath(in both rest and rpc) should return a serializable struct in the
form `{"\":"Q...cid..string..."}` (as used in "github.com/ipfs/go-cid"
to marshal and unmarshal)
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 1f4869568a8adb450275257154ea3a26d03a30f3
Merge: 7acfd28 a244af9
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Jan 23 07:18:56 2019 +0530
Merge branch 'master' into issue_450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 7acfd282732ddf2282a67d4f9d0170a494eb3ed4
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Jan 22 18:14:32 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
- RPC must always use serializable structs
- In command, just use pin with path as cid is also a valid path
- Addressing many other small review comments as in
https://github.com/ipfs/ipfs-cluster/pull/634#pullrequestreview-192122534
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 36905041e1e3f0b204942030aab3ab7b5b9e4d62
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Jan 16 09:36:42 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
Extra logic for path checking should go into resolve so that it can be
properly reused
Added sharness tests
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 9116bda3534e77bb391d873051bb520a1b01a326
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Jan 16 08:08:07 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
error strings should not be capitalized
Fixes #450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit ca7e61861374f456300a85ddc0374e594f74f963
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Jan 15 23:40:25 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
Tests
Fixes #450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 522fbcd899f01c01680375561a32a87464157c0a
Merge: f1a56ab f7bc468
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Jan 15 10:40:54 2019 +0530
Merge branch 'master' into issue_450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit f1a56ab925fb74c0c44273a4524afa4843cf757f
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Mon Jan 14 20:58:17 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
- IPFS Connector should act as a pure IPFS client, any extra logic
should go to cluster.go
- Use cid.Undef, instead of cid.Cid{}
Fixes #450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit c83b91054f6774f1f9d4930cfc3f1fa28236f57c
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Thu Jan 10 08:57:17 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
- Separate handlers, methods and rpc apis for PinPath and UnpinPath from
Pin and Unpin
- Support ipld paths as well
Fixes #450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 719dff88129366ce3ccb5e04cb6f8082a0915c5c
Merge: 91ceb47 21170c4
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Jan 9 19:38:35 2019 +0530
Merge branch 'issue_450_old' into HEAD
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 91ceb4796259ca7ef2974ec43e6a278a12796b13
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Jan 9 19:36:41 2019 +0530
Revert "WIP: Figure out why test does not impleme"
This reverts commit 28a3a3f25dce6f296c8cbef86221644c099a7e75.
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 28a3a3f25dce6f296c8cbef86221644c099a7e75
Author: cd10012 <ced361@nyu.edu>
Date: Tue Jul 24 23:23:10 2018 -0400
WIP: Figure out why test does not implement IPFSConnector interface...
License: MIT
Signed-off-by: cd10012 <ced361@nyu.edu>
commit 21170c48e77e69583db64544b08120a9baf40d8d
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Jan 8 10:37:59 2019 +0530
Support PinPath, UnpinPath (resolve before pinning)
This commit adds API support for pinning using path
`POST /pins/<ipfs or ipns path>` and `DELETE /pins/<ipfs or ipns path>`
will resolve the path into a cid and perform perform pinning or
unpinning
Fixes #450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Co-authored-by: Hector Sanjuan <hector@protocol.ai>
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2019-02-20 11:07:50 +00:00
|
|
|
arg := c.Args().First()
|
2018-01-15 18:32:54 +00:00
|
|
|
rpl := c.Int("replication")
|
|
|
|
rplMin := c.Int("replication-min")
|
|
|
|
rplMax := c.Int("replication-max")
|
|
|
|
if rpl != 0 {
|
|
|
|
rplMin = rpl
|
|
|
|
rplMax = rpl
|
|
|
|
}
|
|
|
|
|
2019-08-11 08:17:17 +00:00
|
|
|
var userAllocs []peer.ID
|
|
|
|
if c.String("allocations") != "" {
|
|
|
|
allocs := strings.Split(c.String("allocations"), ",")
|
|
|
|
for i := range allocs {
|
|
|
|
allocs[i] = strings.TrimSpace(allocs[i])
|
|
|
|
}
|
|
|
|
userAllocs = api.StringsToPeers(allocs)
|
|
|
|
if len(userAllocs) != len(allocs) {
|
|
|
|
checkErr("decoding allocations", errors.New("some peer IDs could not be decoded"))
|
|
|
|
}
|
2019-04-29 14:24:38 +00:00
|
|
|
}
|
2019-09-18 16:05:55 +00:00
|
|
|
var expireAt time.Time
|
|
|
|
if expireIn := c.String("expire-in"); expireIn != "" {
|
|
|
|
d, err := time.ParseDuration(expireIn)
|
|
|
|
checkErr("parsing expire-in", err)
|
|
|
|
expireAt = time.Now().Add(d)
|
|
|
|
}
|
2019-04-29 14:24:38 +00:00
|
|
|
|
Add PinPath/UnpinPath support.
Squashed commit of the following:
commit 38cf569c6aed77c46ee4e0f8baa4d1a9daf8f03e
Merge: d125f69 aaada42
Author: Hector Sanjuan <hsanjuan@users.noreply.github.com>
Date: Wed Feb 20 11:02:00 2019 +0000
Merge pull request #634 from ipfs/issue_450
Support PinPath, UnpinPath (resolve before pinning)
commit aaada42054e1f1c7b2abb1270859d0de41a0e5d8
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Feb 19 22:16:25 2019 +0530
formatResponse accepts api.Pin and not api.PinSerial
commit b5da4bea045865814cc422da71827b44ddd44b90
Merge: ba59036 cc8dd7e
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Feb 19 21:36:46 2019 +0530
Merge branch 'master' into issue_450
commit ba5903649c1df1dba20f4d6f7e3573d6fe24921f
Merge: f002914 d59880c
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Mon Feb 18 08:41:11 2019 +0530
Merge branch 'issue_450' of github.com:ipfs/ipfs-cluster into issue_450
commit f00291494c0c02621c2296cbb7ac71e4c23aa9ec
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Mon Feb 18 08:31:39 2019 +0530
PinPath: more improvements
Added tracing for new methods
commit d59880c338eaa8214fe06b4f930a540793d78407
Merge: 0ca4c7c b4f0eb3
Author: Hector Sanjuan <hsanjuan@users.noreply.github.com>
Date: Wed Feb 13 15:22:49 2019 +0000
Merge branch 'master' into issue_450
commit 0ca4c7c3b0670ed9c8279f8274d36e3485c10030
Merge: d35017a ecef9ea
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Feb 12 13:10:13 2019 +0530
Merge branch 'master' into issue_450
commit d35017a8de91ca9fc9a9a047c48c75134cee9f98
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Feb 12 13:07:25 2019 +0530
PinPath: more improvements
- Worth having `PinOptions` as a separate field in the struct and
constructing the query in the test with ToQuery()
- sharness: "intialization" line can be placed outside the tests at
the top
commit 68e3b90417ffbad89d41a70ac81d85f9037f8848
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Sun Feb 10 21:43:50 2019 +0530
Using if-continue pattern instead of if-else
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 3c29799f3b85be328b27508332ab92049d8b82f3
Merge: 956790b 4324889
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Thu Feb 7 10:25:52 2019 +0530
Merge branch 'master' into issue_450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 956790b381db9858e4194f983e898b07dc51ba66
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Feb 6 21:11:20 2019 +0530
Removing resolved path
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 7191cc46cedfbec116a9746937e28881b50ca044
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Feb 6 16:45:07 2019 +0530
Fix go vet
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit f8b3d5b63b1b7569e2a3e0d82894fd4491c246c4
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Feb 6 16:07:03 2019 +0530
Fixed linting error
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 23c57eb467755a1f21387a1615a7f34e97348053
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Feb 6 09:20:41 2019 +0530
Fixed tests
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 0caedd94aefeb3b6649dedc214cb4b849ace2ea4
Merge: 17e555e 5a7ee1d
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Feb 6 00:07:10 2019 +0530
Merge branch 'master' into issue_450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 17e555e4a7c574413df90aac70c5cc29cab98f54
Author: Hector Sanjuan <code@hector.link>
Date: Tue Feb 5 16:58:50 2019 +0000
PinPath: address some feedback + improvements
* Changed client's Pin() API and PinPath to be consistent
* Added helper methods to turn PinPath to query and back
* Make code and tests build
* Use TestCidResolved everywhere
* Fix cluster.PinPath arguments
* Fix formatting of responses with --no-status
* Make tests readable and call Fatal when needed
* Use a pathTestCases variable
commit f0e7369c47c5ddadc8ed45df5fd2d4d9b2d42b38
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Feb 5 18:34:26 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
Addressed review comments as in
https://github.com/ipfs/ipfs-cluster/pull/634#pullrequestreview-198751932
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit a8b4f181d2d7afed32ee41331dfaab19fd66a173
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Jan 29 22:41:27 2019 +0530
Fixing tests
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit e39b95ca19e4d75506f4f492678245ef13936a44
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Jan 29 14:52:53 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
- PinPath and UnpinPath should return api.Pin
- PinPath should accept pin options
- Removing duplicate logic for Resolve from cluster
- And many other review comments https://github.com/ipfs/ipfs-cluster/pull/634#pullrequestreview-195509504
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit d146075126320896665ba58d337a13789f68ea86
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Jan 23 17:08:41 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
PinPath(in both rest and rpc) should return a serializable struct in the
form `{"\":"Q...cid..string..."}` (as used in "github.com/ipfs/go-cid"
to marshal and unmarshal)
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 1f4869568a8adb450275257154ea3a26d03a30f3
Merge: 7acfd28 a244af9
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Jan 23 07:18:56 2019 +0530
Merge branch 'master' into issue_450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 7acfd282732ddf2282a67d4f9d0170a494eb3ed4
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Jan 22 18:14:32 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
- RPC must always use serializable structs
- In command, just use pin with path as cid is also a valid path
- Addressing many other small review comments as in
https://github.com/ipfs/ipfs-cluster/pull/634#pullrequestreview-192122534
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 36905041e1e3f0b204942030aab3ab7b5b9e4d62
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Jan 16 09:36:42 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
Extra logic for path checking should go into resolve so that it can be
properly reused
Added sharness tests
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 9116bda3534e77bb391d873051bb520a1b01a326
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Jan 16 08:08:07 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
error strings should not be capitalized
Fixes #450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit ca7e61861374f456300a85ddc0374e594f74f963
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Jan 15 23:40:25 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
Tests
Fixes #450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 522fbcd899f01c01680375561a32a87464157c0a
Merge: f1a56ab f7bc468
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Jan 15 10:40:54 2019 +0530
Merge branch 'master' into issue_450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit f1a56ab925fb74c0c44273a4524afa4843cf757f
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Mon Jan 14 20:58:17 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
- IPFS Connector should act as a pure IPFS client, any extra logic
should go to cluster.go
- Use cid.Undef, instead of cid.Cid{}
Fixes #450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit c83b91054f6774f1f9d4930cfc3f1fa28236f57c
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Thu Jan 10 08:57:17 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
- Separate handlers, methods and rpc apis for PinPath and UnpinPath from
Pin and Unpin
- Support ipld paths as well
Fixes #450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 719dff88129366ce3ccb5e04cb6f8082a0915c5c
Merge: 91ceb47 21170c4
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Jan 9 19:38:35 2019 +0530
Merge branch 'issue_450_old' into HEAD
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 91ceb4796259ca7ef2974ec43e6a278a12796b13
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Jan 9 19:36:41 2019 +0530
Revert "WIP: Figure out why test does not impleme"
This reverts commit 28a3a3f25dce6f296c8cbef86221644c099a7e75.
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 28a3a3f25dce6f296c8cbef86221644c099a7e75
Author: cd10012 <ced361@nyu.edu>
Date: Tue Jul 24 23:23:10 2018 -0400
WIP: Figure out why test does not implement IPFSConnector interface...
License: MIT
Signed-off-by: cd10012 <ced361@nyu.edu>
commit 21170c48e77e69583db64544b08120a9baf40d8d
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Jan 8 10:37:59 2019 +0530
Support PinPath, UnpinPath (resolve before pinning)
This commit adds API support for pinning using path
`POST /pins/<ipfs or ipns path>` and `DELETE /pins/<ipfs or ipns path>`
will resolve the path into a cid and perform perform pinning or
unpinning
Fixes #450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Co-authored-by: Hector Sanjuan <hector@protocol.ai>
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2019-02-20 11:07:50 +00:00
|
|
|
opts := api.PinOptions{
|
|
|
|
ReplicationFactorMin: rplMin,
|
|
|
|
ReplicationFactorMax: rplMax,
|
|
|
|
Name: c.String("name"),
|
2020-04-17 11:36:05 +00:00
|
|
|
Mode: api.PinModeFromString(c.String("mode")),
|
2019-04-29 14:24:38 +00:00
|
|
|
UserAllocations: userAllocs,
|
2019-09-18 16:05:55 +00:00
|
|
|
ExpireAt: expireAt,
|
2019-08-26 09:00:45 +00:00
|
|
|
Metadata: parseMetadata(c.StringSlice("metadata")),
|
Add PinPath/UnpinPath support.
Squashed commit of the following:
commit 38cf569c6aed77c46ee4e0f8baa4d1a9daf8f03e
Merge: d125f69 aaada42
Author: Hector Sanjuan <hsanjuan@users.noreply.github.com>
Date: Wed Feb 20 11:02:00 2019 +0000
Merge pull request #634 from ipfs/issue_450
Support PinPath, UnpinPath (resolve before pinning)
commit aaada42054e1f1c7b2abb1270859d0de41a0e5d8
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Feb 19 22:16:25 2019 +0530
formatResponse accepts api.Pin and not api.PinSerial
commit b5da4bea045865814cc422da71827b44ddd44b90
Merge: ba59036 cc8dd7e
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Feb 19 21:36:46 2019 +0530
Merge branch 'master' into issue_450
commit ba5903649c1df1dba20f4d6f7e3573d6fe24921f
Merge: f002914 d59880c
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Mon Feb 18 08:41:11 2019 +0530
Merge branch 'issue_450' of github.com:ipfs/ipfs-cluster into issue_450
commit f00291494c0c02621c2296cbb7ac71e4c23aa9ec
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Mon Feb 18 08:31:39 2019 +0530
PinPath: more improvements
Added tracing for new methods
commit d59880c338eaa8214fe06b4f930a540793d78407
Merge: 0ca4c7c b4f0eb3
Author: Hector Sanjuan <hsanjuan@users.noreply.github.com>
Date: Wed Feb 13 15:22:49 2019 +0000
Merge branch 'master' into issue_450
commit 0ca4c7c3b0670ed9c8279f8274d36e3485c10030
Merge: d35017a ecef9ea
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Feb 12 13:10:13 2019 +0530
Merge branch 'master' into issue_450
commit d35017a8de91ca9fc9a9a047c48c75134cee9f98
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Feb 12 13:07:25 2019 +0530
PinPath: more improvements
- Worth having `PinOptions` as a separate field in the struct and
constructing the query in the test with ToQuery()
- sharness: "intialization" line can be placed outside the tests at
the top
commit 68e3b90417ffbad89d41a70ac81d85f9037f8848
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Sun Feb 10 21:43:50 2019 +0530
Using if-continue pattern instead of if-else
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 3c29799f3b85be328b27508332ab92049d8b82f3
Merge: 956790b 4324889
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Thu Feb 7 10:25:52 2019 +0530
Merge branch 'master' into issue_450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 956790b381db9858e4194f983e898b07dc51ba66
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Feb 6 21:11:20 2019 +0530
Removing resolved path
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 7191cc46cedfbec116a9746937e28881b50ca044
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Feb 6 16:45:07 2019 +0530
Fix go vet
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit f8b3d5b63b1b7569e2a3e0d82894fd4491c246c4
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Feb 6 16:07:03 2019 +0530
Fixed linting error
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 23c57eb467755a1f21387a1615a7f34e97348053
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Feb 6 09:20:41 2019 +0530
Fixed tests
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 0caedd94aefeb3b6649dedc214cb4b849ace2ea4
Merge: 17e555e 5a7ee1d
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Feb 6 00:07:10 2019 +0530
Merge branch 'master' into issue_450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 17e555e4a7c574413df90aac70c5cc29cab98f54
Author: Hector Sanjuan <code@hector.link>
Date: Tue Feb 5 16:58:50 2019 +0000
PinPath: address some feedback + improvements
* Changed client's Pin() API and PinPath to be consistent
* Added helper methods to turn PinPath to query and back
* Make code and tests build
* Use TestCidResolved everywhere
* Fix cluster.PinPath arguments
* Fix formatting of responses with --no-status
* Make tests readable and call Fatal when needed
* Use a pathTestCases variable
commit f0e7369c47c5ddadc8ed45df5fd2d4d9b2d42b38
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Feb 5 18:34:26 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
Addressed review comments as in
https://github.com/ipfs/ipfs-cluster/pull/634#pullrequestreview-198751932
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit a8b4f181d2d7afed32ee41331dfaab19fd66a173
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Jan 29 22:41:27 2019 +0530
Fixing tests
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit e39b95ca19e4d75506f4f492678245ef13936a44
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Jan 29 14:52:53 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
- PinPath and UnpinPath should return api.Pin
- PinPath should accept pin options
- Removing duplicate logic for Resolve from cluster
- And many other review comments https://github.com/ipfs/ipfs-cluster/pull/634#pullrequestreview-195509504
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit d146075126320896665ba58d337a13789f68ea86
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Jan 23 17:08:41 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
PinPath(in both rest and rpc) should return a serializable struct in the
form `{"\":"Q...cid..string..."}` (as used in "github.com/ipfs/go-cid"
to marshal and unmarshal)
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 1f4869568a8adb450275257154ea3a26d03a30f3
Merge: 7acfd28 a244af9
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Jan 23 07:18:56 2019 +0530
Merge branch 'master' into issue_450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 7acfd282732ddf2282a67d4f9d0170a494eb3ed4
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Jan 22 18:14:32 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
- RPC must always use serializable structs
- In command, just use pin with path as cid is also a valid path
- Addressing many other small review comments as in
https://github.com/ipfs/ipfs-cluster/pull/634#pullrequestreview-192122534
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 36905041e1e3f0b204942030aab3ab7b5b9e4d62
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Jan 16 09:36:42 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
Extra logic for path checking should go into resolve so that it can be
properly reused
Added sharness tests
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 9116bda3534e77bb391d873051bb520a1b01a326
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Jan 16 08:08:07 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
error strings should not be capitalized
Fixes #450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit ca7e61861374f456300a85ddc0374e594f74f963
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Jan 15 23:40:25 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
Tests
Fixes #450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 522fbcd899f01c01680375561a32a87464157c0a
Merge: f1a56ab f7bc468
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Jan 15 10:40:54 2019 +0530
Merge branch 'master' into issue_450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit f1a56ab925fb74c0c44273a4524afa4843cf757f
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Mon Jan 14 20:58:17 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
- IPFS Connector should act as a pure IPFS client, any extra logic
should go to cluster.go
- Use cid.Undef, instead of cid.Cid{}
Fixes #450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit c83b91054f6774f1f9d4930cfc3f1fa28236f57c
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Thu Jan 10 08:57:17 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
- Separate handlers, methods and rpc apis for PinPath and UnpinPath from
Pin and Unpin
- Support ipld paths as well
Fixes #450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 719dff88129366ce3ccb5e04cb6f8082a0915c5c
Merge: 91ceb47 21170c4
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Jan 9 19:38:35 2019 +0530
Merge branch 'issue_450_old' into HEAD
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 91ceb4796259ca7ef2974ec43e6a278a12796b13
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Jan 9 19:36:41 2019 +0530
Revert "WIP: Figure out why test does not impleme"
This reverts commit 28a3a3f25dce6f296c8cbef86221644c099a7e75.
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 28a3a3f25dce6f296c8cbef86221644c099a7e75
Author: cd10012 <ced361@nyu.edu>
Date: Tue Jul 24 23:23:10 2018 -0400
WIP: Figure out why test does not implement IPFSConnector interface...
License: MIT
Signed-off-by: cd10012 <ced361@nyu.edu>
commit 21170c48e77e69583db64544b08120a9baf40d8d
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Jan 8 10:37:59 2019 +0530
Support PinPath, UnpinPath (resolve before pinning)
This commit adds API support for pinning using path
`POST /pins/<ipfs or ipns path>` and `DELETE /pins/<ipfs or ipns path>`
will resolve the path into a cid and perform perform pinning or
unpinning
Fixes #450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Co-authored-by: Hector Sanjuan <hector@protocol.ai>
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2019-02-20 11:07:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pin, cerr := globalClient.PinPath(ctx, arg, opts)
|
2017-12-05 20:44:22 +00:00
|
|
|
if cerr != nil {
|
|
|
|
formatResponse(c, nil, cerr)
|
|
|
|
return nil
|
2017-03-13 10:10:53 +00:00
|
|
|
}
|
2018-03-29 08:33:09 +00:00
|
|
|
handlePinResponseFormatFlags(
|
2018-06-27 04:03:15 +00:00
|
|
|
ctx,
|
2018-03-28 14:04:21 +00:00
|
|
|
c,
|
Add PinPath/UnpinPath support.
Squashed commit of the following:
commit 38cf569c6aed77c46ee4e0f8baa4d1a9daf8f03e
Merge: d125f69 aaada42
Author: Hector Sanjuan <hsanjuan@users.noreply.github.com>
Date: Wed Feb 20 11:02:00 2019 +0000
Merge pull request #634 from ipfs/issue_450
Support PinPath, UnpinPath (resolve before pinning)
commit aaada42054e1f1c7b2abb1270859d0de41a0e5d8
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Feb 19 22:16:25 2019 +0530
formatResponse accepts api.Pin and not api.PinSerial
commit b5da4bea045865814cc422da71827b44ddd44b90
Merge: ba59036 cc8dd7e
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Feb 19 21:36:46 2019 +0530
Merge branch 'master' into issue_450
commit ba5903649c1df1dba20f4d6f7e3573d6fe24921f
Merge: f002914 d59880c
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Mon Feb 18 08:41:11 2019 +0530
Merge branch 'issue_450' of github.com:ipfs/ipfs-cluster into issue_450
commit f00291494c0c02621c2296cbb7ac71e4c23aa9ec
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Mon Feb 18 08:31:39 2019 +0530
PinPath: more improvements
Added tracing for new methods
commit d59880c338eaa8214fe06b4f930a540793d78407
Merge: 0ca4c7c b4f0eb3
Author: Hector Sanjuan <hsanjuan@users.noreply.github.com>
Date: Wed Feb 13 15:22:49 2019 +0000
Merge branch 'master' into issue_450
commit 0ca4c7c3b0670ed9c8279f8274d36e3485c10030
Merge: d35017a ecef9ea
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Feb 12 13:10:13 2019 +0530
Merge branch 'master' into issue_450
commit d35017a8de91ca9fc9a9a047c48c75134cee9f98
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Feb 12 13:07:25 2019 +0530
PinPath: more improvements
- Worth having `PinOptions` as a separate field in the struct and
constructing the query in the test with ToQuery()
- sharness: "intialization" line can be placed outside the tests at
the top
commit 68e3b90417ffbad89d41a70ac81d85f9037f8848
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Sun Feb 10 21:43:50 2019 +0530
Using if-continue pattern instead of if-else
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 3c29799f3b85be328b27508332ab92049d8b82f3
Merge: 956790b 4324889
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Thu Feb 7 10:25:52 2019 +0530
Merge branch 'master' into issue_450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 956790b381db9858e4194f983e898b07dc51ba66
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Feb 6 21:11:20 2019 +0530
Removing resolved path
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 7191cc46cedfbec116a9746937e28881b50ca044
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Feb 6 16:45:07 2019 +0530
Fix go vet
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit f8b3d5b63b1b7569e2a3e0d82894fd4491c246c4
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Feb 6 16:07:03 2019 +0530
Fixed linting error
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 23c57eb467755a1f21387a1615a7f34e97348053
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Feb 6 09:20:41 2019 +0530
Fixed tests
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 0caedd94aefeb3b6649dedc214cb4b849ace2ea4
Merge: 17e555e 5a7ee1d
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Feb 6 00:07:10 2019 +0530
Merge branch 'master' into issue_450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 17e555e4a7c574413df90aac70c5cc29cab98f54
Author: Hector Sanjuan <code@hector.link>
Date: Tue Feb 5 16:58:50 2019 +0000
PinPath: address some feedback + improvements
* Changed client's Pin() API and PinPath to be consistent
* Added helper methods to turn PinPath to query and back
* Make code and tests build
* Use TestCidResolved everywhere
* Fix cluster.PinPath arguments
* Fix formatting of responses with --no-status
* Make tests readable and call Fatal when needed
* Use a pathTestCases variable
commit f0e7369c47c5ddadc8ed45df5fd2d4d9b2d42b38
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Feb 5 18:34:26 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
Addressed review comments as in
https://github.com/ipfs/ipfs-cluster/pull/634#pullrequestreview-198751932
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit a8b4f181d2d7afed32ee41331dfaab19fd66a173
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Jan 29 22:41:27 2019 +0530
Fixing tests
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit e39b95ca19e4d75506f4f492678245ef13936a44
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Jan 29 14:52:53 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
- PinPath and UnpinPath should return api.Pin
- PinPath should accept pin options
- Removing duplicate logic for Resolve from cluster
- And many other review comments https://github.com/ipfs/ipfs-cluster/pull/634#pullrequestreview-195509504
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit d146075126320896665ba58d337a13789f68ea86
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Jan 23 17:08:41 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
PinPath(in both rest and rpc) should return a serializable struct in the
form `{"\":"Q...cid..string..."}` (as used in "github.com/ipfs/go-cid"
to marshal and unmarshal)
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 1f4869568a8adb450275257154ea3a26d03a30f3
Merge: 7acfd28 a244af9
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Jan 23 07:18:56 2019 +0530
Merge branch 'master' into issue_450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 7acfd282732ddf2282a67d4f9d0170a494eb3ed4
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Jan 22 18:14:32 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
- RPC must always use serializable structs
- In command, just use pin with path as cid is also a valid path
- Addressing many other small review comments as in
https://github.com/ipfs/ipfs-cluster/pull/634#pullrequestreview-192122534
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 36905041e1e3f0b204942030aab3ab7b5b9e4d62
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Jan 16 09:36:42 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
Extra logic for path checking should go into resolve so that it can be
properly reused
Added sharness tests
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 9116bda3534e77bb391d873051bb520a1b01a326
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Jan 16 08:08:07 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
error strings should not be capitalized
Fixes #450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit ca7e61861374f456300a85ddc0374e594f74f963
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Jan 15 23:40:25 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
Tests
Fixes #450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 522fbcd899f01c01680375561a32a87464157c0a
Merge: f1a56ab f7bc468
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Jan 15 10:40:54 2019 +0530
Merge branch 'master' into issue_450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit f1a56ab925fb74c0c44273a4524afa4843cf757f
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Mon Jan 14 20:58:17 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
- IPFS Connector should act as a pure IPFS client, any extra logic
should go to cluster.go
- Use cid.Undef, instead of cid.Cid{}
Fixes #450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit c83b91054f6774f1f9d4930cfc3f1fa28236f57c
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Thu Jan 10 08:57:17 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
- Separate handlers, methods and rpc apis for PinPath and UnpinPath from
Pin and Unpin
- Support ipld paths as well
Fixes #450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 719dff88129366ce3ccb5e04cb6f8082a0915c5c
Merge: 91ceb47 21170c4
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Jan 9 19:38:35 2019 +0530
Merge branch 'issue_450_old' into HEAD
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 91ceb4796259ca7ef2974ec43e6a278a12796b13
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Jan 9 19:36:41 2019 +0530
Revert "WIP: Figure out why test does not impleme"
This reverts commit 28a3a3f25dce6f296c8cbef86221644c099a7e75.
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 28a3a3f25dce6f296c8cbef86221644c099a7e75
Author: cd10012 <ced361@nyu.edu>
Date: Tue Jul 24 23:23:10 2018 -0400
WIP: Figure out why test does not implement IPFSConnector interface...
License: MIT
Signed-off-by: cd10012 <ced361@nyu.edu>
commit 21170c48e77e69583db64544b08120a9baf40d8d
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Jan 8 10:37:59 2019 +0530
Support PinPath, UnpinPath (resolve before pinning)
This commit adds API support for pinning using path
`POST /pins/<ipfs or ipns path>` and `DELETE /pins/<ipfs or ipns path>`
will resolve the path into a cid and perform perform pinning or
unpinning
Fixes #450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Co-authored-by: Hector Sanjuan <hector@protocol.ai>
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2019-02-20 11:07:50 +00:00
|
|
|
pin,
|
2018-03-28 14:04:21 +00:00
|
|
|
api.TrackerStatusPinned,
|
|
|
|
)
|
2017-01-24 18:55:06 +00:00
|
|
|
return nil
|
2017-01-24 14:06:17 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "rm",
|
2019-07-12 14:40:29 +00:00
|
|
|
Usage: "Unpin an item from the cluster",
|
2017-07-03 16:36:00 +00:00
|
|
|
Description: `
|
2016-12-22 16:14:15 +00:00
|
|
|
This command tells IPFS Cluster to no longer manage a CID. This will
|
|
|
|
trigger unpinning operations in all the IPFS nodes holding the content.
|
|
|
|
|
2017-01-24 14:06:17 +00:00
|
|
|
When the request has succeeded, the command returns the status of the CID
|
2017-01-25 17:10:18 +00:00
|
|
|
in the cluster. The CID should disappear from the list offered by "pin ls",
|
2017-01-24 14:06:17 +00:00
|
|
|
although unpinning operations in the cluster may take longer or fail.
|
|
|
|
`,
|
2019-07-12 14:40:29 +00:00
|
|
|
ArgsUsage: "<CID|Path>",
|
2018-03-06 07:00:05 +00:00
|
|
|
Flags: []cli.Flag{
|
|
|
|
cli.BoolFlag{
|
|
|
|
Name: "no-status, ns",
|
|
|
|
Usage: "Prevents fetching pin status after unpinning (faster, quieter)",
|
|
|
|
},
|
2018-03-14 08:49:49 +00:00
|
|
|
cli.BoolFlag{
|
|
|
|
Name: "wait, w",
|
|
|
|
Usage: "Wait for all nodes to report a status of unpinned before returning",
|
|
|
|
},
|
|
|
|
cli.DurationFlag{
|
|
|
|
Name: "wait-timeout, wt",
|
|
|
|
Value: 0,
|
|
|
|
Usage: "How long to --wait (in seconds), default is indefinitely",
|
|
|
|
},
|
2018-03-06 07:00:05 +00:00
|
|
|
},
|
2017-01-24 18:55:06 +00:00
|
|
|
Action: func(c *cli.Context) error {
|
Add PinPath/UnpinPath support.
Squashed commit of the following:
commit 38cf569c6aed77c46ee4e0f8baa4d1a9daf8f03e
Merge: d125f69 aaada42
Author: Hector Sanjuan <hsanjuan@users.noreply.github.com>
Date: Wed Feb 20 11:02:00 2019 +0000
Merge pull request #634 from ipfs/issue_450
Support PinPath, UnpinPath (resolve before pinning)
commit aaada42054e1f1c7b2abb1270859d0de41a0e5d8
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Feb 19 22:16:25 2019 +0530
formatResponse accepts api.Pin and not api.PinSerial
commit b5da4bea045865814cc422da71827b44ddd44b90
Merge: ba59036 cc8dd7e
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Feb 19 21:36:46 2019 +0530
Merge branch 'master' into issue_450
commit ba5903649c1df1dba20f4d6f7e3573d6fe24921f
Merge: f002914 d59880c
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Mon Feb 18 08:41:11 2019 +0530
Merge branch 'issue_450' of github.com:ipfs/ipfs-cluster into issue_450
commit f00291494c0c02621c2296cbb7ac71e4c23aa9ec
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Mon Feb 18 08:31:39 2019 +0530
PinPath: more improvements
Added tracing for new methods
commit d59880c338eaa8214fe06b4f930a540793d78407
Merge: 0ca4c7c b4f0eb3
Author: Hector Sanjuan <hsanjuan@users.noreply.github.com>
Date: Wed Feb 13 15:22:49 2019 +0000
Merge branch 'master' into issue_450
commit 0ca4c7c3b0670ed9c8279f8274d36e3485c10030
Merge: d35017a ecef9ea
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Feb 12 13:10:13 2019 +0530
Merge branch 'master' into issue_450
commit d35017a8de91ca9fc9a9a047c48c75134cee9f98
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Feb 12 13:07:25 2019 +0530
PinPath: more improvements
- Worth having `PinOptions` as a separate field in the struct and
constructing the query in the test with ToQuery()
- sharness: "intialization" line can be placed outside the tests at
the top
commit 68e3b90417ffbad89d41a70ac81d85f9037f8848
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Sun Feb 10 21:43:50 2019 +0530
Using if-continue pattern instead of if-else
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 3c29799f3b85be328b27508332ab92049d8b82f3
Merge: 956790b 4324889
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Thu Feb 7 10:25:52 2019 +0530
Merge branch 'master' into issue_450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 956790b381db9858e4194f983e898b07dc51ba66
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Feb 6 21:11:20 2019 +0530
Removing resolved path
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 7191cc46cedfbec116a9746937e28881b50ca044
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Feb 6 16:45:07 2019 +0530
Fix go vet
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit f8b3d5b63b1b7569e2a3e0d82894fd4491c246c4
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Feb 6 16:07:03 2019 +0530
Fixed linting error
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 23c57eb467755a1f21387a1615a7f34e97348053
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Feb 6 09:20:41 2019 +0530
Fixed tests
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 0caedd94aefeb3b6649dedc214cb4b849ace2ea4
Merge: 17e555e 5a7ee1d
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Feb 6 00:07:10 2019 +0530
Merge branch 'master' into issue_450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 17e555e4a7c574413df90aac70c5cc29cab98f54
Author: Hector Sanjuan <code@hector.link>
Date: Tue Feb 5 16:58:50 2019 +0000
PinPath: address some feedback + improvements
* Changed client's Pin() API and PinPath to be consistent
* Added helper methods to turn PinPath to query and back
* Make code and tests build
* Use TestCidResolved everywhere
* Fix cluster.PinPath arguments
* Fix formatting of responses with --no-status
* Make tests readable and call Fatal when needed
* Use a pathTestCases variable
commit f0e7369c47c5ddadc8ed45df5fd2d4d9b2d42b38
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Feb 5 18:34:26 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
Addressed review comments as in
https://github.com/ipfs/ipfs-cluster/pull/634#pullrequestreview-198751932
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit a8b4f181d2d7afed32ee41331dfaab19fd66a173
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Jan 29 22:41:27 2019 +0530
Fixing tests
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit e39b95ca19e4d75506f4f492678245ef13936a44
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Jan 29 14:52:53 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
- PinPath and UnpinPath should return api.Pin
- PinPath should accept pin options
- Removing duplicate logic for Resolve from cluster
- And many other review comments https://github.com/ipfs/ipfs-cluster/pull/634#pullrequestreview-195509504
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit d146075126320896665ba58d337a13789f68ea86
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Jan 23 17:08:41 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
PinPath(in both rest and rpc) should return a serializable struct in the
form `{"\":"Q...cid..string..."}` (as used in "github.com/ipfs/go-cid"
to marshal and unmarshal)
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 1f4869568a8adb450275257154ea3a26d03a30f3
Merge: 7acfd28 a244af9
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Jan 23 07:18:56 2019 +0530
Merge branch 'master' into issue_450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 7acfd282732ddf2282a67d4f9d0170a494eb3ed4
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Jan 22 18:14:32 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
- RPC must always use serializable structs
- In command, just use pin with path as cid is also a valid path
- Addressing many other small review comments as in
https://github.com/ipfs/ipfs-cluster/pull/634#pullrequestreview-192122534
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 36905041e1e3f0b204942030aab3ab7b5b9e4d62
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Jan 16 09:36:42 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
Extra logic for path checking should go into resolve so that it can be
properly reused
Added sharness tests
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 9116bda3534e77bb391d873051bb520a1b01a326
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Jan 16 08:08:07 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
error strings should not be capitalized
Fixes #450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit ca7e61861374f456300a85ddc0374e594f74f963
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Jan 15 23:40:25 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
Tests
Fixes #450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 522fbcd899f01c01680375561a32a87464157c0a
Merge: f1a56ab f7bc468
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Jan 15 10:40:54 2019 +0530
Merge branch 'master' into issue_450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit f1a56ab925fb74c0c44273a4524afa4843cf757f
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Mon Jan 14 20:58:17 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
- IPFS Connector should act as a pure IPFS client, any extra logic
should go to cluster.go
- Use cid.Undef, instead of cid.Cid{}
Fixes #450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit c83b91054f6774f1f9d4930cfc3f1fa28236f57c
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Thu Jan 10 08:57:17 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
- Separate handlers, methods and rpc apis for PinPath and UnpinPath from
Pin and Unpin
- Support ipld paths as well
Fixes #450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 719dff88129366ce3ccb5e04cb6f8082a0915c5c
Merge: 91ceb47 21170c4
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Jan 9 19:38:35 2019 +0530
Merge branch 'issue_450_old' into HEAD
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 91ceb4796259ca7ef2974ec43e6a278a12796b13
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Jan 9 19:36:41 2019 +0530
Revert "WIP: Figure out why test does not impleme"
This reverts commit 28a3a3f25dce6f296c8cbef86221644c099a7e75.
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 28a3a3f25dce6f296c8cbef86221644c099a7e75
Author: cd10012 <ced361@nyu.edu>
Date: Tue Jul 24 23:23:10 2018 -0400
WIP: Figure out why test does not implement IPFSConnector interface...
License: MIT
Signed-off-by: cd10012 <ced361@nyu.edu>
commit 21170c48e77e69583db64544b08120a9baf40d8d
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Jan 8 10:37:59 2019 +0530
Support PinPath, UnpinPath (resolve before pinning)
This commit adds API support for pinning using path
`POST /pins/<ipfs or ipns path>` and `DELETE /pins/<ipfs or ipns path>`
will resolve the path into a cid and perform perform pinning or
unpinning
Fixes #450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Co-authored-by: Hector Sanjuan <hector@protocol.ai>
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2019-02-20 11:07:50 +00:00
|
|
|
arg := c.Args().First()
|
|
|
|
pin, cerr := globalClient.UnpinPath(ctx, arg)
|
2017-12-05 20:44:22 +00:00
|
|
|
if cerr != nil {
|
|
|
|
formatResponse(c, nil, cerr)
|
|
|
|
return nil
|
2017-03-13 10:10:53 +00:00
|
|
|
}
|
2018-03-29 08:33:09 +00:00
|
|
|
handlePinResponseFormatFlags(
|
2018-06-27 04:03:15 +00:00
|
|
|
ctx,
|
2018-03-28 14:04:21 +00:00
|
|
|
c,
|
Add PinPath/UnpinPath support.
Squashed commit of the following:
commit 38cf569c6aed77c46ee4e0f8baa4d1a9daf8f03e
Merge: d125f69 aaada42
Author: Hector Sanjuan <hsanjuan@users.noreply.github.com>
Date: Wed Feb 20 11:02:00 2019 +0000
Merge pull request #634 from ipfs/issue_450
Support PinPath, UnpinPath (resolve before pinning)
commit aaada42054e1f1c7b2abb1270859d0de41a0e5d8
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Feb 19 22:16:25 2019 +0530
formatResponse accepts api.Pin and not api.PinSerial
commit b5da4bea045865814cc422da71827b44ddd44b90
Merge: ba59036 cc8dd7e
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Feb 19 21:36:46 2019 +0530
Merge branch 'master' into issue_450
commit ba5903649c1df1dba20f4d6f7e3573d6fe24921f
Merge: f002914 d59880c
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Mon Feb 18 08:41:11 2019 +0530
Merge branch 'issue_450' of github.com:ipfs/ipfs-cluster into issue_450
commit f00291494c0c02621c2296cbb7ac71e4c23aa9ec
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Mon Feb 18 08:31:39 2019 +0530
PinPath: more improvements
Added tracing for new methods
commit d59880c338eaa8214fe06b4f930a540793d78407
Merge: 0ca4c7c b4f0eb3
Author: Hector Sanjuan <hsanjuan@users.noreply.github.com>
Date: Wed Feb 13 15:22:49 2019 +0000
Merge branch 'master' into issue_450
commit 0ca4c7c3b0670ed9c8279f8274d36e3485c10030
Merge: d35017a ecef9ea
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Feb 12 13:10:13 2019 +0530
Merge branch 'master' into issue_450
commit d35017a8de91ca9fc9a9a047c48c75134cee9f98
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Feb 12 13:07:25 2019 +0530
PinPath: more improvements
- Worth having `PinOptions` as a separate field in the struct and
constructing the query in the test with ToQuery()
- sharness: "intialization" line can be placed outside the tests at
the top
commit 68e3b90417ffbad89d41a70ac81d85f9037f8848
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Sun Feb 10 21:43:50 2019 +0530
Using if-continue pattern instead of if-else
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 3c29799f3b85be328b27508332ab92049d8b82f3
Merge: 956790b 4324889
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Thu Feb 7 10:25:52 2019 +0530
Merge branch 'master' into issue_450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 956790b381db9858e4194f983e898b07dc51ba66
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Feb 6 21:11:20 2019 +0530
Removing resolved path
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 7191cc46cedfbec116a9746937e28881b50ca044
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Feb 6 16:45:07 2019 +0530
Fix go vet
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit f8b3d5b63b1b7569e2a3e0d82894fd4491c246c4
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Feb 6 16:07:03 2019 +0530
Fixed linting error
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 23c57eb467755a1f21387a1615a7f34e97348053
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Feb 6 09:20:41 2019 +0530
Fixed tests
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 0caedd94aefeb3b6649dedc214cb4b849ace2ea4
Merge: 17e555e 5a7ee1d
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Feb 6 00:07:10 2019 +0530
Merge branch 'master' into issue_450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 17e555e4a7c574413df90aac70c5cc29cab98f54
Author: Hector Sanjuan <code@hector.link>
Date: Tue Feb 5 16:58:50 2019 +0000
PinPath: address some feedback + improvements
* Changed client's Pin() API and PinPath to be consistent
* Added helper methods to turn PinPath to query and back
* Make code and tests build
* Use TestCidResolved everywhere
* Fix cluster.PinPath arguments
* Fix formatting of responses with --no-status
* Make tests readable and call Fatal when needed
* Use a pathTestCases variable
commit f0e7369c47c5ddadc8ed45df5fd2d4d9b2d42b38
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Feb 5 18:34:26 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
Addressed review comments as in
https://github.com/ipfs/ipfs-cluster/pull/634#pullrequestreview-198751932
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit a8b4f181d2d7afed32ee41331dfaab19fd66a173
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Jan 29 22:41:27 2019 +0530
Fixing tests
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit e39b95ca19e4d75506f4f492678245ef13936a44
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Jan 29 14:52:53 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
- PinPath and UnpinPath should return api.Pin
- PinPath should accept pin options
- Removing duplicate logic for Resolve from cluster
- And many other review comments https://github.com/ipfs/ipfs-cluster/pull/634#pullrequestreview-195509504
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit d146075126320896665ba58d337a13789f68ea86
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Jan 23 17:08:41 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
PinPath(in both rest and rpc) should return a serializable struct in the
form `{"\":"Q...cid..string..."}` (as used in "github.com/ipfs/go-cid"
to marshal and unmarshal)
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 1f4869568a8adb450275257154ea3a26d03a30f3
Merge: 7acfd28 a244af9
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Jan 23 07:18:56 2019 +0530
Merge branch 'master' into issue_450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 7acfd282732ddf2282a67d4f9d0170a494eb3ed4
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Jan 22 18:14:32 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
- RPC must always use serializable structs
- In command, just use pin with path as cid is also a valid path
- Addressing many other small review comments as in
https://github.com/ipfs/ipfs-cluster/pull/634#pullrequestreview-192122534
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 36905041e1e3f0b204942030aab3ab7b5b9e4d62
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Jan 16 09:36:42 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
Extra logic for path checking should go into resolve so that it can be
properly reused
Added sharness tests
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 9116bda3534e77bb391d873051bb520a1b01a326
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Jan 16 08:08:07 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
error strings should not be capitalized
Fixes #450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit ca7e61861374f456300a85ddc0374e594f74f963
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Jan 15 23:40:25 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
Tests
Fixes #450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 522fbcd899f01c01680375561a32a87464157c0a
Merge: f1a56ab f7bc468
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Jan 15 10:40:54 2019 +0530
Merge branch 'master' into issue_450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit f1a56ab925fb74c0c44273a4524afa4843cf757f
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Mon Jan 14 20:58:17 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
- IPFS Connector should act as a pure IPFS client, any extra logic
should go to cluster.go
- Use cid.Undef, instead of cid.Cid{}
Fixes #450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit c83b91054f6774f1f9d4930cfc3f1fa28236f57c
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Thu Jan 10 08:57:17 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
- Separate handlers, methods and rpc apis for PinPath and UnpinPath from
Pin and Unpin
- Support ipld paths as well
Fixes #450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 719dff88129366ce3ccb5e04cb6f8082a0915c5c
Merge: 91ceb47 21170c4
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Jan 9 19:38:35 2019 +0530
Merge branch 'issue_450_old' into HEAD
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 91ceb4796259ca7ef2974ec43e6a278a12796b13
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Jan 9 19:36:41 2019 +0530
Revert "WIP: Figure out why test does not impleme"
This reverts commit 28a3a3f25dce6f296c8cbef86221644c099a7e75.
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 28a3a3f25dce6f296c8cbef86221644c099a7e75
Author: cd10012 <ced361@nyu.edu>
Date: Tue Jul 24 23:23:10 2018 -0400
WIP: Figure out why test does not implement IPFSConnector interface...
License: MIT
Signed-off-by: cd10012 <ced361@nyu.edu>
commit 21170c48e77e69583db64544b08120a9baf40d8d
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Jan 8 10:37:59 2019 +0530
Support PinPath, UnpinPath (resolve before pinning)
This commit adds API support for pinning using path
`POST /pins/<ipfs or ipns path>` and `DELETE /pins/<ipfs or ipns path>`
will resolve the path into a cid and perform perform pinning or
unpinning
Fixes #450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Co-authored-by: Hector Sanjuan <hector@protocol.ai>
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2019-02-20 11:07:50 +00:00
|
|
|
pin,
|
2018-03-28 14:04:21 +00:00
|
|
|
api.TrackerStatusUnpinned,
|
|
|
|
)
|
2017-01-24 18:55:06 +00:00
|
|
|
return nil
|
2017-01-24 14:06:17 +00:00
|
|
|
},
|
|
|
|
},
|
2019-07-12 14:40:29 +00:00
|
|
|
{
|
|
|
|
Name: "update",
|
|
|
|
Usage: "Pin a new item based on an existing one",
|
|
|
|
Description: `
|
|
|
|
This command will add a new pin to the cluster taking all the options from an
|
|
|
|
existing one, including name. This means that the new pin will bypass the
|
|
|
|
allocation process and will be allocated to the same peers as the existing
|
|
|
|
one.
|
|
|
|
|
|
|
|
The cluster peers will try to Pin the new item on IPFS using the "pin update"
|
|
|
|
command. This is especially efficient when the content of two pins (their DAGs)
|
|
|
|
are similar.
|
|
|
|
|
|
|
|
Unlike the "pin update" command in the ipfs daemon, this will not unpin the
|
|
|
|
existing item from the cluster. Please run "pin rm" for that.
|
|
|
|
`,
|
|
|
|
ArgsUsage: "<existing-CID> <new-CID|Path>",
|
|
|
|
Flags: []cli.Flag{
|
|
|
|
cli.BoolFlag{
|
|
|
|
Name: "no-status, ns",
|
|
|
|
Usage: "Prevents fetching pin status after unpinning (faster, quieter)",
|
|
|
|
},
|
|
|
|
cli.BoolFlag{
|
|
|
|
Name: "wait, w",
|
|
|
|
Usage: "Wait for all nodes to report a status of pinned before returning",
|
|
|
|
},
|
|
|
|
cli.DurationFlag{
|
|
|
|
Name: "wait-timeout, wt",
|
|
|
|
Value: 0,
|
|
|
|
Usage: "How long to --wait (in seconds), default is indefinitely",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
Action: func(c *cli.Context) error {
|
|
|
|
from := c.Args().Get(0)
|
|
|
|
to := c.Args().Get(1)
|
|
|
|
|
|
|
|
fromCid, err := cid.Decode(from)
|
|
|
|
checkErr("parsing from Cid", err)
|
|
|
|
|
|
|
|
opts := api.PinOptions{
|
|
|
|
PinUpdate: fromCid,
|
|
|
|
}
|
|
|
|
|
|
|
|
pin, cerr := globalClient.PinPath(ctx, to, opts)
|
|
|
|
if cerr != nil {
|
|
|
|
formatResponse(c, nil, cerr)
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
handlePinResponseFormatFlags(
|
|
|
|
ctx,
|
|
|
|
c,
|
|
|
|
pin,
|
|
|
|
api.TrackerStatusPinned,
|
|
|
|
)
|
|
|
|
return nil
|
|
|
|
},
|
|
|
|
},
|
2017-01-24 14:06:17 +00:00
|
|
|
{
|
|
|
|
Name: "ls",
|
2018-07-23 09:14:43 +00:00
|
|
|
Usage: "List items in the cluster pinset",
|
2017-07-03 16:36:00 +00:00
|
|
|
Description: `
|
2017-02-13 15:46:53 +00:00
|
|
|
This command will list the CIDs which are tracked by IPFS Cluster and to
|
|
|
|
which peers they are currently allocated. This list does not include
|
2017-04-06 02:27:02 +00:00
|
|
|
any monitoring information about the IPFS status of the CIDs, it
|
|
|
|
merely represents the list of pins which are part of the shared state of
|
|
|
|
the cluster. For IPFS-status information about the pins, use "status".
|
2018-07-23 09:14:43 +00:00
|
|
|
|
2018-08-10 12:39:44 +00:00
|
|
|
The filter only takes effect when listing all pins. The possible values are:
|
|
|
|
- all
|
2020-04-17 11:36:05 +00:00
|
|
|
- pin (normal pins, recursive or direct)
|
|
|
|
- meta-pin (sharded pins)
|
|
|
|
- clusterdag-pin (sharding-dag root pins)
|
|
|
|
- shard-pin (individual shard pins)
|
2017-01-24 14:06:17 +00:00
|
|
|
`,
|
2017-07-03 16:36:00 +00:00
|
|
|
ArgsUsage: "[CID]",
|
2018-03-18 19:29:02 +00:00
|
|
|
Flags: []cli.Flag{
|
2018-08-10 12:39:44 +00:00
|
|
|
cli.StringFlag{
|
|
|
|
Name: "filter",
|
|
|
|
Usage: "Comma separated list of pin types. See help above.",
|
|
|
|
Value: "pin",
|
2018-03-18 19:29:02 +00:00
|
|
|
},
|
|
|
|
},
|
2017-01-24 18:55:06 +00:00
|
|
|
Action: func(c *cli.Context) error {
|
2017-04-06 02:27:02 +00:00
|
|
|
cidStr := c.Args().First()
|
|
|
|
if cidStr != "" {
|
2017-12-05 20:44:22 +00:00
|
|
|
ci, err := cid.Decode(cidStr)
|
2017-04-06 02:27:02 +00:00
|
|
|
checkErr("parsing cid", err)
|
2018-06-27 04:03:15 +00:00
|
|
|
resp, cerr := globalClient.Allocation(ctx, ci)
|
2017-12-05 20:44:22 +00:00
|
|
|
formatResponse(c, resp, cerr)
|
|
|
|
} else {
|
2018-08-10 12:53:46 +00:00
|
|
|
var filter api.PinType
|
2018-08-10 12:39:44 +00:00
|
|
|
strFilter := strings.Split(c.String("filter"), ",")
|
|
|
|
for _, f := range strFilter {
|
|
|
|
filter |= api.PinTypeFromString(f)
|
2018-03-18 19:29:02 +00:00
|
|
|
}
|
2018-08-10 12:39:44 +00:00
|
|
|
|
2018-06-27 04:03:15 +00:00
|
|
|
resp, cerr := globalClient.Allocations(ctx, filter)
|
2017-12-05 20:44:22 +00:00
|
|
|
formatResponse(c, resp, cerr)
|
2017-04-06 02:27:02 +00:00
|
|
|
}
|
2017-01-24 18:55:06 +00:00
|
|
|
return nil
|
2017-01-24 14:06:17 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Name: "status",
|
|
|
|
Usage: "Retrieve the status of tracked items",
|
2017-07-03 16:36:00 +00:00
|
|
|
Description: `
|
2016-12-22 16:14:15 +00:00
|
|
|
This command retrieves the status of the CIDs tracked by IPFS
|
|
|
|
Cluster, including which member is pinning them and any errors.
|
|
|
|
If a CID is provided, the status will be only fetched for a single
|
2018-03-18 19:29:02 +00:00
|
|
|
item. Metadata CIDs are included in the status response
|
2017-01-25 18:38:23 +00:00
|
|
|
|
2017-12-01 11:56:26 +00:00
|
|
|
When the --local flag is passed, it will only fetch the status from the
|
|
|
|
contacted cluster peer. By default, status will be fetched from all peers.
|
Status filters for `ipfs-cluster-ctl status`
Added filter option to `ipfs-cluster-ctl status`
When the --filter is passed, it will only fetch the peer information
where status of the pin matches with the filter value.
Valid filter values are tracker status types(i.e., "pinned",
"pin_error", "unpinning" etc), an alias of tracker status type (i.e.,
"queued" or "error"), comma separated list of tracker status type
and/or it aliases(i.e., "error,pinning")
On passing invalid filter value no status information will be shown
In particular, the filter would remove elements from []GlobalPinInfo
when none of the peers in GlobalPinInfo match the filter. If one peer
in the GlobalPinInfo matches the filter, the whole object is returned,
including the information for the other peers which may or not match it.
filter option works on statusAll("GET /pins"). For fetching pin status
for a CID("GET /pins/<cid>"), filter option would have no effect
Fixes #445
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
2018-12-20 08:02:26 +00:00
|
|
|
|
2019-01-07 18:45:07 +00:00
|
|
|
When the --filter flag is passed, it will only fetch the peer information
|
|
|
|
where status of the pin matches at least one of the filter values (a comma
|
|
|
|
separated list). The following are valid status values:
|
2019-01-05 09:10:54 +00:00
|
|
|
|
2019-01-07 18:45:07 +00:00
|
|
|
` + trackerStatusAllString(),
|
2017-07-03 16:36:00 +00:00
|
|
|
ArgsUsage: "[CID]",
|
2017-12-01 11:56:26 +00:00
|
|
|
Flags: []cli.Flag{
|
|
|
|
localFlag(),
|
Status filters for `ipfs-cluster-ctl status`
Added filter option to `ipfs-cluster-ctl status`
When the --filter is passed, it will only fetch the peer information
where status of the pin matches with the filter value.
Valid filter values are tracker status types(i.e., "pinned",
"pin_error", "unpinning" etc), an alias of tracker status type (i.e.,
"queued" or "error"), comma separated list of tracker status type
and/or it aliases(i.e., "error,pinning")
On passing invalid filter value no status information will be shown
In particular, the filter would remove elements from []GlobalPinInfo
when none of the peers in GlobalPinInfo match the filter. If one peer
in the GlobalPinInfo matches the filter, the whole object is returned,
including the information for the other peers which may or not match it.
filter option works on statusAll("GET /pins"). For fetching pin status
for a CID("GET /pins/<cid>"), filter option would have no effect
Fixes #445
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
2018-12-20 08:02:26 +00:00
|
|
|
cli.StringFlag{
|
|
|
|
Name: "filter",
|
2019-01-07 18:45:07 +00:00
|
|
|
Usage: "comma-separated list of filters",
|
Status filters for `ipfs-cluster-ctl status`
Added filter option to `ipfs-cluster-ctl status`
When the --filter is passed, it will only fetch the peer information
where status of the pin matches with the filter value.
Valid filter values are tracker status types(i.e., "pinned",
"pin_error", "unpinning" etc), an alias of tracker status type (i.e.,
"queued" or "error"), comma separated list of tracker status type
and/or it aliases(i.e., "error,pinning")
On passing invalid filter value no status information will be shown
In particular, the filter would remove elements from []GlobalPinInfo
when none of the peers in GlobalPinInfo match the filter. If one peer
in the GlobalPinInfo matches the filter, the whole object is returned,
including the information for the other peers which may or not match it.
filter option works on statusAll("GET /pins"). For fetching pin status
for a CID("GET /pins/<cid>"), filter option would have no effect
Fixes #445
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
2018-12-20 08:02:26 +00:00
|
|
|
},
|
2017-12-01 11:56:26 +00:00
|
|
|
},
|
2017-01-24 18:55:06 +00:00
|
|
|
Action: func(c *cli.Context) error {
|
2017-01-24 14:06:17 +00:00
|
|
|
cidStr := c.Args().First()
|
|
|
|
if cidStr != "" {
|
2017-12-05 20:44:22 +00:00
|
|
|
ci, err := cid.Decode(cidStr)
|
2017-01-24 14:06:17 +00:00
|
|
|
checkErr("parsing cid", err)
|
2018-06-27 04:03:15 +00:00
|
|
|
resp, cerr := globalClient.Status(ctx, ci, c.Bool("local"))
|
2017-12-05 20:44:22 +00:00
|
|
|
formatResponse(c, resp, cerr)
|
|
|
|
} else {
|
2019-01-08 11:28:29 +00:00
|
|
|
filterFlag := c.String("filter")
|
|
|
|
filter := api.TrackerStatusFromString(c.String("filter"))
|
|
|
|
if filter == api.TrackerStatusUndefined && filterFlag != "" {
|
|
|
|
checkErr("parsing filter flag", errors.New("invalid filter name"))
|
|
|
|
}
|
2018-06-27 04:03:15 +00:00
|
|
|
resp, cerr := globalClient.StatusAll(ctx, filter, c.Bool("local"))
|
2017-12-05 20:44:22 +00:00
|
|
|
formatResponse(c, resp, cerr)
|
2017-01-24 14:06:17 +00:00
|
|
|
}
|
2017-01-24 18:55:06 +00:00
|
|
|
return nil
|
2017-01-24 14:06:17 +00:00
|
|
|
},
|
|
|
|
},
|
2017-01-25 18:38:23 +00:00
|
|
|
{
|
|
|
|
Name: "recover",
|
|
|
|
Usage: "Recover tracked items in error state",
|
2017-07-03 16:36:00 +00:00
|
|
|
Description: `
|
2017-11-30 00:53:31 +00:00
|
|
|
This command asks Cluster peers to re-track or re-forget CIDs in
|
2017-01-25 18:38:23 +00:00
|
|
|
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
|
2017-11-30 00:53:31 +00:00
|
|
|
of the item upon completion. Note that, when running on the full sets of tracked
|
2017-12-04 12:59:48 +00:00
|
|
|
CIDs (without argument), it may take a considerably long time.
|
2017-11-30 00:53:31 +00:00
|
|
|
|
2017-12-01 11:56:26 +00:00
|
|
|
When the --local flag is passed, it will only trigger recover
|
|
|
|
operations on the contacted peer (as opposed to on every peer).
|
2017-01-25 18:38:23 +00:00
|
|
|
`,
|
2017-11-30 00:53:31 +00:00
|
|
|
ArgsUsage: "[CID]",
|
|
|
|
Flags: []cli.Flag{
|
2017-12-01 11:56:26 +00:00
|
|
|
localFlag(),
|
2017-11-30 00:53:31 +00:00
|
|
|
},
|
2017-01-25 18:38:23 +00:00
|
|
|
Action: func(c *cli.Context) error {
|
|
|
|
cidStr := c.Args().First()
|
|
|
|
if cidStr != "" {
|
2017-12-05 20:44:22 +00:00
|
|
|
ci, err := cid.Decode(cidStr)
|
2017-01-25 18:38:23 +00:00
|
|
|
checkErr("parsing cid", err)
|
2018-06-27 04:03:15 +00:00
|
|
|
resp, cerr := globalClient.Recover(ctx, ci, c.Bool("local"))
|
2017-12-05 20:44:22 +00:00
|
|
|
formatResponse(c, resp, cerr)
|
2017-01-25 18:38:23 +00:00
|
|
|
} else {
|
2018-06-27 04:03:15 +00:00
|
|
|
resp, cerr := globalClient.RecoverAll(ctx, c.Bool("local"))
|
2017-12-05 20:44:22 +00:00
|
|
|
formatResponse(c, resp, cerr)
|
2017-01-25 18:38:23 +00:00
|
|
|
}
|
|
|
|
return nil
|
|
|
|
},
|
|
|
|
},
|
2018-01-18 02:49:35 +00:00
|
|
|
|
2017-01-24 15:24:46 +00:00
|
|
|
{
|
|
|
|
Name: "version",
|
|
|
|
Usage: "Retrieve cluster version",
|
2017-07-03 16:36:00 +00:00
|
|
|
Description: `
|
2017-01-24 15:24:46 +00:00
|
|
|
This command retrieves the IPFS Cluster version and can be used
|
|
|
|
to check that it matches the CLI version (shown by -v).
|
|
|
|
`,
|
2017-07-03 16:36:00 +00:00
|
|
|
ArgsUsage: " ",
|
2017-12-05 20:44:22 +00:00
|
|
|
Flags: []cli.Flag{},
|
2017-01-24 18:55:06 +00:00
|
|
|
Action: func(c *cli.Context) error {
|
2018-06-27 04:03:15 +00:00
|
|
|
resp, cerr := globalClient.Version(ctx)
|
2017-12-05 20:44:22 +00:00
|
|
|
formatResponse(c, resp, cerr)
|
2017-02-08 18:52:34 +00:00
|
|
|
return nil
|
|
|
|
},
|
|
|
|
},
|
2018-01-18 02:49:35 +00:00
|
|
|
{
|
|
|
|
Name: "health",
|
2018-07-23 09:14:43 +00:00
|
|
|
Usage: "Cluster monitoring information",
|
|
|
|
Description: "Cluster monitoring information",
|
2018-01-18 02:49:35 +00:00
|
|
|
Subcommands: []cli.Command{
|
|
|
|
{
|
|
|
|
Name: "graph",
|
2018-07-23 09:14:43 +00:00
|
|
|
Usage: "create a graph displaying connectivity of cluster peers",
|
2018-01-18 02:49:35 +00:00
|
|
|
Description: `
|
2018-01-23 13:33:12 +00:00
|
|
|
This command queries all connected cluster peers and their ipfs peers to generate a
|
2018-01-18 02:49:35 +00:00
|
|
|
graph of the connections. Output is a dot file encoding the cluster's connection state.
|
|
|
|
`,
|
|
|
|
Flags: []cli.Flag{
|
|
|
|
cli.StringFlag{
|
|
|
|
Name: "file, f",
|
|
|
|
Value: "",
|
|
|
|
Usage: "sets an output dot-file for the connectivity graph",
|
|
|
|
},
|
|
|
|
cli.BoolFlag{
|
|
|
|
Name: "all-ipfs-peers",
|
|
|
|
Usage: "causes the graph to mark nodes for ipfs peers not directly in the cluster",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
Action: func(c *cli.Context) error {
|
2018-06-27 04:03:15 +00:00
|
|
|
resp, cerr := globalClient.GetConnectGraph(ctx)
|
2018-01-18 02:49:35 +00:00
|
|
|
if cerr != nil {
|
|
|
|
formatResponse(c, resp, cerr)
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
var w io.WriteCloser
|
|
|
|
var err error
|
|
|
|
outputPath := c.String("file")
|
|
|
|
if outputPath == "" {
|
|
|
|
w = os.Stdout
|
|
|
|
} else {
|
|
|
|
w, err = os.Create(outputPath)
|
|
|
|
checkErr("creating output file", err)
|
|
|
|
}
|
|
|
|
defer w.Close()
|
|
|
|
err = makeDot(resp, w, c.Bool("all-ipfs-peers"))
|
|
|
|
checkErr("printing graph", err)
|
|
|
|
|
|
|
|
return nil
|
|
|
|
},
|
|
|
|
},
|
2018-10-07 16:32:46 +00:00
|
|
|
{
|
|
|
|
Name: "metrics",
|
2018-10-21 06:34:50 +00:00
|
|
|
Usage: "List latest metrics logged by this peer",
|
2018-10-07 16:32:46 +00:00
|
|
|
Description: `
|
2018-10-21 06:34:50 +00:00
|
|
|
This commands displays the latest valid metrics of the given type logged
|
|
|
|
by this peer for all current cluster peers.
|
2018-10-23 18:21:27 +00:00
|
|
|
|
2019-10-24 14:37:26 +00:00
|
|
|
If no argument is provided, the command retrieves all currently existing metric types.
|
|
|
|
|
2018-10-23 18:21:27 +00:00
|
|
|
Currently supported metrics depend on the informer component used,
|
|
|
|
but usually are:
|
|
|
|
|
|
|
|
- freespace
|
|
|
|
- ping
|
2018-10-07 16:32:46 +00:00
|
|
|
`,
|
2018-10-23 18:21:27 +00:00
|
|
|
ArgsUsage: "<metric name>",
|
2018-10-07 16:32:46 +00:00
|
|
|
Action: func(c *cli.Context) error {
|
2018-10-23 18:21:27 +00:00
|
|
|
metric := c.Args().First()
|
|
|
|
if metric == "" {
|
2019-10-24 14:37:26 +00:00
|
|
|
resp, cerr := globalClient.MetricNames(ctx)
|
|
|
|
formatResponse(c, resp, cerr)
|
|
|
|
return nil
|
2018-10-23 18:21:27 +00:00
|
|
|
}
|
|
|
|
|
2018-06-27 04:03:15 +00:00
|
|
|
resp, cerr := globalClient.Metrics(ctx, metric)
|
2018-10-07 16:32:46 +00:00
|
|
|
formatResponse(c, resp, cerr)
|
|
|
|
return nil
|
|
|
|
},
|
|
|
|
},
|
2018-01-18 02:49:35 +00:00
|
|
|
},
|
|
|
|
},
|
2019-10-22 05:40:32 +00:00
|
|
|
{
|
|
|
|
Name: "ipfs",
|
|
|
|
Usage: "Manage IPFS daemon",
|
|
|
|
Description: "Manage IPFS daemon",
|
|
|
|
Subcommands: []cli.Command{
|
|
|
|
{
|
|
|
|
Name: "gc",
|
|
|
|
Usage: "run garbage collection on IPFS repos of cluster peers",
|
|
|
|
Description: `
|
|
|
|
This command will instruct current Cluster peers to run "repo gc" on their
|
|
|
|
respective IPFS daemons.
|
|
|
|
|
|
|
|
When --local flag is passed, it will garbage collect only on the local IPFS
|
|
|
|
deamon, otherwise on all IPFS daemons.
|
|
|
|
`,
|
|
|
|
Flags: []cli.Flag{
|
|
|
|
localFlag(),
|
|
|
|
},
|
|
|
|
Action: func(c *cli.Context) error {
|
|
|
|
resp, cerr := globalClient.RepoGC(ctx, c.Bool("local"))
|
|
|
|
formatResponse(c, resp, cerr)
|
|
|
|
return nil
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2017-02-08 18:52:34 +00:00
|
|
|
{
|
2017-07-03 16:36:00 +00:00
|
|
|
Name: "commands",
|
|
|
|
Usage: "List all commands",
|
|
|
|
ArgsUsage: " ",
|
|
|
|
Hidden: true,
|
2017-02-08 18:52:34 +00:00
|
|
|
Action: func(c *cli.Context) error {
|
2017-07-03 16:36:00 +00:00
|
|
|
walkCommands(c.App.Commands, "ipfs-cluster-ctl")
|
2017-01-24 18:55:06 +00:00
|
|
|
return nil
|
2017-01-24 15:24:46 +00:00
|
|
|
},
|
|
|
|
},
|
2016-12-22 16:14:15 +00:00
|
|
|
}
|
|
|
|
|
2017-01-24 14:06:17 +00:00
|
|
|
app.Run(os.Args)
|
2016-12-22 16:14:15 +00:00
|
|
|
}
|
|
|
|
|
2017-12-01 11:56:26 +00:00
|
|
|
func localFlag() cli.BoolFlag {
|
|
|
|
return cli.BoolFlag{
|
|
|
|
Name: "local",
|
|
|
|
Usage: "run operation only on the contacted peer",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-07-03 16:36:00 +00:00
|
|
|
func walkCommands(cmds []cli.Command, parentHelpName string) {
|
2017-02-08 18:52:34 +00:00
|
|
|
for _, c := range cmds {
|
2017-07-14 19:22:52 +00:00
|
|
|
h := c.HelpName
|
|
|
|
// Sometimes HelpName is empty
|
|
|
|
if h == "" {
|
2017-07-03 16:36:00 +00:00
|
|
|
h = fmt.Sprintf("%s %s", parentHelpName, c.FullName())
|
|
|
|
}
|
2017-07-14 19:22:52 +00:00
|
|
|
fmt.Println(h)
|
2017-07-03 16:36:00 +00:00
|
|
|
walkCommands(c.Subcommands, h)
|
2017-02-08 18:52:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-12-08 15:12:57 +00:00
|
|
|
func formatResponse(c *cli.Context, resp interface{}, err error) {
|
2017-12-05 20:44:22 +00:00
|
|
|
enc := c.GlobalString("encoding")
|
|
|
|
if resp == nil && err == nil {
|
|
|
|
return
|
2017-08-29 01:41:54 +00:00
|
|
|
}
|
|
|
|
|
2017-12-05 20:44:22 +00:00
|
|
|
if err != nil {
|
2017-12-08 15:12:57 +00:00
|
|
|
cerr, ok := err.(*api.Error)
|
|
|
|
if !ok {
|
2018-08-20 10:08:49 +00:00
|
|
|
checkErr("", err)
|
2017-12-08 15:12:57 +00:00
|
|
|
}
|
2017-02-08 18:52:34 +00:00
|
|
|
switch enc {
|
|
|
|
case "text":
|
2017-12-08 15:12:57 +00:00
|
|
|
textFormatPrintError(cerr)
|
2017-12-05 20:44:22 +00:00
|
|
|
case "json":
|
2017-12-08 15:12:57 +00:00
|
|
|
jsonFormatPrint(cerr)
|
2017-02-08 18:52:34 +00:00
|
|
|
default:
|
2017-12-05 20:44:22 +00:00
|
|
|
checkErr("", errors.New("unsupported encoding selected"))
|
2017-02-08 18:52:34 +00:00
|
|
|
}
|
2017-12-08 15:12:57 +00:00
|
|
|
if cerr.Code == 0 {
|
2017-12-07 11:00:28 +00:00
|
|
|
os.Exit(1) // problem with the call
|
|
|
|
} else {
|
|
|
|
os.Exit(2) // call went fine, response has an error
|
|
|
|
}
|
2016-12-22 16:14:15 +00:00
|
|
|
}
|
2017-12-05 20:44:22 +00:00
|
|
|
|
|
|
|
switch enc {
|
|
|
|
case "text":
|
|
|
|
textFormatObject(resp)
|
|
|
|
case "json":
|
|
|
|
jsonFormatObject(resp)
|
|
|
|
default:
|
|
|
|
checkErr("", errors.New("unsupported encoding selected"))
|
|
|
|
}
|
2016-12-22 16:14:15 +00:00
|
|
|
}
|
|
|
|
|
2017-08-29 01:41:54 +00:00
|
|
|
func parseCredentials(userInput string) (string, string) {
|
|
|
|
credentials := strings.SplitN(userInput, ":", 2)
|
|
|
|
switch len(credentials) {
|
|
|
|
case 1:
|
|
|
|
// only username passed in (with no trailing `:`), return empty password
|
|
|
|
return credentials[0], ""
|
|
|
|
case 2:
|
|
|
|
return credentials[0], credentials[1]
|
|
|
|
default:
|
|
|
|
err := fmt.Errorf("invalid <username>[:<password>] input")
|
|
|
|
checkErr("parsing credentials", err)
|
|
|
|
return "", ""
|
|
|
|
}
|
|
|
|
}
|
2018-03-28 14:04:21 +00:00
|
|
|
|
2018-03-29 08:33:09 +00:00
|
|
|
func handlePinResponseFormatFlags(
|
2018-06-27 04:03:15 +00:00
|
|
|
ctx context.Context,
|
2018-03-28 14:04:21 +00:00
|
|
|
c *cli.Context,
|
2019-02-27 17:04:35 +00:00
|
|
|
pin *api.Pin,
|
2018-03-28 14:04:21 +00:00
|
|
|
target api.TrackerStatus,
|
|
|
|
) {
|
|
|
|
|
2019-02-27 17:04:35 +00:00
|
|
|
var status *api.GlobalPinInfo
|
2018-03-28 14:04:21 +00:00
|
|
|
var cerr error
|
|
|
|
|
2018-03-29 08:33:09 +00:00
|
|
|
if c.Bool("wait") {
|
Add PinPath/UnpinPath support.
Squashed commit of the following:
commit 38cf569c6aed77c46ee4e0f8baa4d1a9daf8f03e
Merge: d125f69 aaada42
Author: Hector Sanjuan <hsanjuan@users.noreply.github.com>
Date: Wed Feb 20 11:02:00 2019 +0000
Merge pull request #634 from ipfs/issue_450
Support PinPath, UnpinPath (resolve before pinning)
commit aaada42054e1f1c7b2abb1270859d0de41a0e5d8
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Feb 19 22:16:25 2019 +0530
formatResponse accepts api.Pin and not api.PinSerial
commit b5da4bea045865814cc422da71827b44ddd44b90
Merge: ba59036 cc8dd7e
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Feb 19 21:36:46 2019 +0530
Merge branch 'master' into issue_450
commit ba5903649c1df1dba20f4d6f7e3573d6fe24921f
Merge: f002914 d59880c
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Mon Feb 18 08:41:11 2019 +0530
Merge branch 'issue_450' of github.com:ipfs/ipfs-cluster into issue_450
commit f00291494c0c02621c2296cbb7ac71e4c23aa9ec
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Mon Feb 18 08:31:39 2019 +0530
PinPath: more improvements
Added tracing for new methods
commit d59880c338eaa8214fe06b4f930a540793d78407
Merge: 0ca4c7c b4f0eb3
Author: Hector Sanjuan <hsanjuan@users.noreply.github.com>
Date: Wed Feb 13 15:22:49 2019 +0000
Merge branch 'master' into issue_450
commit 0ca4c7c3b0670ed9c8279f8274d36e3485c10030
Merge: d35017a ecef9ea
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Feb 12 13:10:13 2019 +0530
Merge branch 'master' into issue_450
commit d35017a8de91ca9fc9a9a047c48c75134cee9f98
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Feb 12 13:07:25 2019 +0530
PinPath: more improvements
- Worth having `PinOptions` as a separate field in the struct and
constructing the query in the test with ToQuery()
- sharness: "intialization" line can be placed outside the tests at
the top
commit 68e3b90417ffbad89d41a70ac81d85f9037f8848
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Sun Feb 10 21:43:50 2019 +0530
Using if-continue pattern instead of if-else
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 3c29799f3b85be328b27508332ab92049d8b82f3
Merge: 956790b 4324889
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Thu Feb 7 10:25:52 2019 +0530
Merge branch 'master' into issue_450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 956790b381db9858e4194f983e898b07dc51ba66
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Feb 6 21:11:20 2019 +0530
Removing resolved path
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 7191cc46cedfbec116a9746937e28881b50ca044
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Feb 6 16:45:07 2019 +0530
Fix go vet
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit f8b3d5b63b1b7569e2a3e0d82894fd4491c246c4
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Feb 6 16:07:03 2019 +0530
Fixed linting error
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 23c57eb467755a1f21387a1615a7f34e97348053
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Feb 6 09:20:41 2019 +0530
Fixed tests
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 0caedd94aefeb3b6649dedc214cb4b849ace2ea4
Merge: 17e555e 5a7ee1d
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Feb 6 00:07:10 2019 +0530
Merge branch 'master' into issue_450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 17e555e4a7c574413df90aac70c5cc29cab98f54
Author: Hector Sanjuan <code@hector.link>
Date: Tue Feb 5 16:58:50 2019 +0000
PinPath: address some feedback + improvements
* Changed client's Pin() API and PinPath to be consistent
* Added helper methods to turn PinPath to query and back
* Make code and tests build
* Use TestCidResolved everywhere
* Fix cluster.PinPath arguments
* Fix formatting of responses with --no-status
* Make tests readable and call Fatal when needed
* Use a pathTestCases variable
commit f0e7369c47c5ddadc8ed45df5fd2d4d9b2d42b38
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Feb 5 18:34:26 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
Addressed review comments as in
https://github.com/ipfs/ipfs-cluster/pull/634#pullrequestreview-198751932
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit a8b4f181d2d7afed32ee41331dfaab19fd66a173
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Jan 29 22:41:27 2019 +0530
Fixing tests
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit e39b95ca19e4d75506f4f492678245ef13936a44
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Jan 29 14:52:53 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
- PinPath and UnpinPath should return api.Pin
- PinPath should accept pin options
- Removing duplicate logic for Resolve from cluster
- And many other review comments https://github.com/ipfs/ipfs-cluster/pull/634#pullrequestreview-195509504
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit d146075126320896665ba58d337a13789f68ea86
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Jan 23 17:08:41 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
PinPath(in both rest and rpc) should return a serializable struct in the
form `{"\":"Q...cid..string..."}` (as used in "github.com/ipfs/go-cid"
to marshal and unmarshal)
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 1f4869568a8adb450275257154ea3a26d03a30f3
Merge: 7acfd28 a244af9
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Jan 23 07:18:56 2019 +0530
Merge branch 'master' into issue_450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 7acfd282732ddf2282a67d4f9d0170a494eb3ed4
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Jan 22 18:14:32 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
- RPC must always use serializable structs
- In command, just use pin with path as cid is also a valid path
- Addressing many other small review comments as in
https://github.com/ipfs/ipfs-cluster/pull/634#pullrequestreview-192122534
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 36905041e1e3f0b204942030aab3ab7b5b9e4d62
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Jan 16 09:36:42 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
Extra logic for path checking should go into resolve so that it can be
properly reused
Added sharness tests
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 9116bda3534e77bb391d873051bb520a1b01a326
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Jan 16 08:08:07 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
error strings should not be capitalized
Fixes #450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit ca7e61861374f456300a85ddc0374e594f74f963
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Jan 15 23:40:25 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
Tests
Fixes #450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 522fbcd899f01c01680375561a32a87464157c0a
Merge: f1a56ab f7bc468
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Jan 15 10:40:54 2019 +0530
Merge branch 'master' into issue_450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit f1a56ab925fb74c0c44273a4524afa4843cf757f
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Mon Jan 14 20:58:17 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
- IPFS Connector should act as a pure IPFS client, any extra logic
should go to cluster.go
- Use cid.Undef, instead of cid.Cid{}
Fixes #450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit c83b91054f6774f1f9d4930cfc3f1fa28236f57c
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Thu Jan 10 08:57:17 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
- Separate handlers, methods and rpc apis for PinPath and UnpinPath from
Pin and Unpin
- Support ipld paths as well
Fixes #450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 719dff88129366ce3ccb5e04cb6f8082a0915c5c
Merge: 91ceb47 21170c4
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Jan 9 19:38:35 2019 +0530
Merge branch 'issue_450_old' into HEAD
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 91ceb4796259ca7ef2974ec43e6a278a12796b13
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Jan 9 19:36:41 2019 +0530
Revert "WIP: Figure out why test does not impleme"
This reverts commit 28a3a3f25dce6f296c8cbef86221644c099a7e75.
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 28a3a3f25dce6f296c8cbef86221644c099a7e75
Author: cd10012 <ced361@nyu.edu>
Date: Tue Jul 24 23:23:10 2018 -0400
WIP: Figure out why test does not implement IPFSConnector interface...
License: MIT
Signed-off-by: cd10012 <ced361@nyu.edu>
commit 21170c48e77e69583db64544b08120a9baf40d8d
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Jan 8 10:37:59 2019 +0530
Support PinPath, UnpinPath (resolve before pinning)
This commit adds API support for pinning using path
`POST /pins/<ipfs or ipns path>` and `DELETE /pins/<ipfs or ipns path>`
will resolve the path into a cid and perform perform pinning or
unpinning
Fixes #450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Co-authored-by: Hector Sanjuan <hector@protocol.ai>
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2019-02-20 11:07:50 +00:00
|
|
|
status, cerr = waitFor(pin.Cid, target, c.Duration("wait-timeout"))
|
2018-03-28 14:04:21 +00:00
|
|
|
checkErr("waiting for pin status", cerr)
|
|
|
|
}
|
|
|
|
|
2018-03-29 08:33:09 +00:00
|
|
|
if c.Bool("no-status") {
|
Add PinPath/UnpinPath support.
Squashed commit of the following:
commit 38cf569c6aed77c46ee4e0f8baa4d1a9daf8f03e
Merge: d125f69 aaada42
Author: Hector Sanjuan <hsanjuan@users.noreply.github.com>
Date: Wed Feb 20 11:02:00 2019 +0000
Merge pull request #634 from ipfs/issue_450
Support PinPath, UnpinPath (resolve before pinning)
commit aaada42054e1f1c7b2abb1270859d0de41a0e5d8
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Feb 19 22:16:25 2019 +0530
formatResponse accepts api.Pin and not api.PinSerial
commit b5da4bea045865814cc422da71827b44ddd44b90
Merge: ba59036 cc8dd7e
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Feb 19 21:36:46 2019 +0530
Merge branch 'master' into issue_450
commit ba5903649c1df1dba20f4d6f7e3573d6fe24921f
Merge: f002914 d59880c
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Mon Feb 18 08:41:11 2019 +0530
Merge branch 'issue_450' of github.com:ipfs/ipfs-cluster into issue_450
commit f00291494c0c02621c2296cbb7ac71e4c23aa9ec
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Mon Feb 18 08:31:39 2019 +0530
PinPath: more improvements
Added tracing for new methods
commit d59880c338eaa8214fe06b4f930a540793d78407
Merge: 0ca4c7c b4f0eb3
Author: Hector Sanjuan <hsanjuan@users.noreply.github.com>
Date: Wed Feb 13 15:22:49 2019 +0000
Merge branch 'master' into issue_450
commit 0ca4c7c3b0670ed9c8279f8274d36e3485c10030
Merge: d35017a ecef9ea
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Feb 12 13:10:13 2019 +0530
Merge branch 'master' into issue_450
commit d35017a8de91ca9fc9a9a047c48c75134cee9f98
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Feb 12 13:07:25 2019 +0530
PinPath: more improvements
- Worth having `PinOptions` as a separate field in the struct and
constructing the query in the test with ToQuery()
- sharness: "intialization" line can be placed outside the tests at
the top
commit 68e3b90417ffbad89d41a70ac81d85f9037f8848
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Sun Feb 10 21:43:50 2019 +0530
Using if-continue pattern instead of if-else
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 3c29799f3b85be328b27508332ab92049d8b82f3
Merge: 956790b 4324889
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Thu Feb 7 10:25:52 2019 +0530
Merge branch 'master' into issue_450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 956790b381db9858e4194f983e898b07dc51ba66
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Feb 6 21:11:20 2019 +0530
Removing resolved path
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 7191cc46cedfbec116a9746937e28881b50ca044
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Feb 6 16:45:07 2019 +0530
Fix go vet
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit f8b3d5b63b1b7569e2a3e0d82894fd4491c246c4
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Feb 6 16:07:03 2019 +0530
Fixed linting error
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 23c57eb467755a1f21387a1615a7f34e97348053
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Feb 6 09:20:41 2019 +0530
Fixed tests
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 0caedd94aefeb3b6649dedc214cb4b849ace2ea4
Merge: 17e555e 5a7ee1d
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Feb 6 00:07:10 2019 +0530
Merge branch 'master' into issue_450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 17e555e4a7c574413df90aac70c5cc29cab98f54
Author: Hector Sanjuan <code@hector.link>
Date: Tue Feb 5 16:58:50 2019 +0000
PinPath: address some feedback + improvements
* Changed client's Pin() API and PinPath to be consistent
* Added helper methods to turn PinPath to query and back
* Make code and tests build
* Use TestCidResolved everywhere
* Fix cluster.PinPath arguments
* Fix formatting of responses with --no-status
* Make tests readable and call Fatal when needed
* Use a pathTestCases variable
commit f0e7369c47c5ddadc8ed45df5fd2d4d9b2d42b38
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Feb 5 18:34:26 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
Addressed review comments as in
https://github.com/ipfs/ipfs-cluster/pull/634#pullrequestreview-198751932
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit a8b4f181d2d7afed32ee41331dfaab19fd66a173
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Jan 29 22:41:27 2019 +0530
Fixing tests
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit e39b95ca19e4d75506f4f492678245ef13936a44
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Jan 29 14:52:53 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
- PinPath and UnpinPath should return api.Pin
- PinPath should accept pin options
- Removing duplicate logic for Resolve from cluster
- And many other review comments https://github.com/ipfs/ipfs-cluster/pull/634#pullrequestreview-195509504
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit d146075126320896665ba58d337a13789f68ea86
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Jan 23 17:08:41 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
PinPath(in both rest and rpc) should return a serializable struct in the
form `{"\":"Q...cid..string..."}` (as used in "github.com/ipfs/go-cid"
to marshal and unmarshal)
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 1f4869568a8adb450275257154ea3a26d03a30f3
Merge: 7acfd28 a244af9
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Jan 23 07:18:56 2019 +0530
Merge branch 'master' into issue_450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 7acfd282732ddf2282a67d4f9d0170a494eb3ed4
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Jan 22 18:14:32 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
- RPC must always use serializable structs
- In command, just use pin with path as cid is also a valid path
- Addressing many other small review comments as in
https://github.com/ipfs/ipfs-cluster/pull/634#pullrequestreview-192122534
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 36905041e1e3f0b204942030aab3ab7b5b9e4d62
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Jan 16 09:36:42 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
Extra logic for path checking should go into resolve so that it can be
properly reused
Added sharness tests
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 9116bda3534e77bb391d873051bb520a1b01a326
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Jan 16 08:08:07 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
error strings should not be capitalized
Fixes #450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit ca7e61861374f456300a85ddc0374e594f74f963
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Jan 15 23:40:25 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
Tests
Fixes #450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 522fbcd899f01c01680375561a32a87464157c0a
Merge: f1a56ab f7bc468
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Jan 15 10:40:54 2019 +0530
Merge branch 'master' into issue_450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit f1a56ab925fb74c0c44273a4524afa4843cf757f
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Mon Jan 14 20:58:17 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
- IPFS Connector should act as a pure IPFS client, any extra logic
should go to cluster.go
- Use cid.Undef, instead of cid.Cid{}
Fixes #450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit c83b91054f6774f1f9d4930cfc3f1fa28236f57c
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Thu Jan 10 08:57:17 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
- Separate handlers, methods and rpc apis for PinPath and UnpinPath from
Pin and Unpin
- Support ipld paths as well
Fixes #450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 719dff88129366ce3ccb5e04cb6f8082a0915c5c
Merge: 91ceb47 21170c4
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Jan 9 19:38:35 2019 +0530
Merge branch 'issue_450_old' into HEAD
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 91ceb4796259ca7ef2974ec43e6a278a12796b13
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Jan 9 19:36:41 2019 +0530
Revert "WIP: Figure out why test does not impleme"
This reverts commit 28a3a3f25dce6f296c8cbef86221644c099a7e75.
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 28a3a3f25dce6f296c8cbef86221644c099a7e75
Author: cd10012 <ced361@nyu.edu>
Date: Tue Jul 24 23:23:10 2018 -0400
WIP: Figure out why test does not implement IPFSConnector interface...
License: MIT
Signed-off-by: cd10012 <ced361@nyu.edu>
commit 21170c48e77e69583db64544b08120a9baf40d8d
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Jan 8 10:37:59 2019 +0530
Support PinPath, UnpinPath (resolve before pinning)
This commit adds API support for pinning using path
`POST /pins/<ipfs or ipns path>` and `DELETE /pins/<ipfs or ipns path>`
will resolve the path into a cid and perform perform pinning or
unpinning
Fixes #450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Co-authored-by: Hector Sanjuan <hector@protocol.ai>
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2019-02-20 11:07:50 +00:00
|
|
|
formatResponse(c, pin, nil)
|
2018-03-28 14:04:21 +00:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2019-02-27 20:22:36 +00:00
|
|
|
if status == nil { // no status from "wait"
|
2018-03-29 08:33:09 +00:00
|
|
|
time.Sleep(time.Second)
|
Add PinPath/UnpinPath support.
Squashed commit of the following:
commit 38cf569c6aed77c46ee4e0f8baa4d1a9daf8f03e
Merge: d125f69 aaada42
Author: Hector Sanjuan <hsanjuan@users.noreply.github.com>
Date: Wed Feb 20 11:02:00 2019 +0000
Merge pull request #634 from ipfs/issue_450
Support PinPath, UnpinPath (resolve before pinning)
commit aaada42054e1f1c7b2abb1270859d0de41a0e5d8
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Feb 19 22:16:25 2019 +0530
formatResponse accepts api.Pin and not api.PinSerial
commit b5da4bea045865814cc422da71827b44ddd44b90
Merge: ba59036 cc8dd7e
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Feb 19 21:36:46 2019 +0530
Merge branch 'master' into issue_450
commit ba5903649c1df1dba20f4d6f7e3573d6fe24921f
Merge: f002914 d59880c
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Mon Feb 18 08:41:11 2019 +0530
Merge branch 'issue_450' of github.com:ipfs/ipfs-cluster into issue_450
commit f00291494c0c02621c2296cbb7ac71e4c23aa9ec
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Mon Feb 18 08:31:39 2019 +0530
PinPath: more improvements
Added tracing for new methods
commit d59880c338eaa8214fe06b4f930a540793d78407
Merge: 0ca4c7c b4f0eb3
Author: Hector Sanjuan <hsanjuan@users.noreply.github.com>
Date: Wed Feb 13 15:22:49 2019 +0000
Merge branch 'master' into issue_450
commit 0ca4c7c3b0670ed9c8279f8274d36e3485c10030
Merge: d35017a ecef9ea
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Feb 12 13:10:13 2019 +0530
Merge branch 'master' into issue_450
commit d35017a8de91ca9fc9a9a047c48c75134cee9f98
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Feb 12 13:07:25 2019 +0530
PinPath: more improvements
- Worth having `PinOptions` as a separate field in the struct and
constructing the query in the test with ToQuery()
- sharness: "intialization" line can be placed outside the tests at
the top
commit 68e3b90417ffbad89d41a70ac81d85f9037f8848
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Sun Feb 10 21:43:50 2019 +0530
Using if-continue pattern instead of if-else
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 3c29799f3b85be328b27508332ab92049d8b82f3
Merge: 956790b 4324889
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Thu Feb 7 10:25:52 2019 +0530
Merge branch 'master' into issue_450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 956790b381db9858e4194f983e898b07dc51ba66
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Feb 6 21:11:20 2019 +0530
Removing resolved path
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 7191cc46cedfbec116a9746937e28881b50ca044
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Feb 6 16:45:07 2019 +0530
Fix go vet
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit f8b3d5b63b1b7569e2a3e0d82894fd4491c246c4
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Feb 6 16:07:03 2019 +0530
Fixed linting error
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 23c57eb467755a1f21387a1615a7f34e97348053
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Feb 6 09:20:41 2019 +0530
Fixed tests
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 0caedd94aefeb3b6649dedc214cb4b849ace2ea4
Merge: 17e555e 5a7ee1d
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Feb 6 00:07:10 2019 +0530
Merge branch 'master' into issue_450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 17e555e4a7c574413df90aac70c5cc29cab98f54
Author: Hector Sanjuan <code@hector.link>
Date: Tue Feb 5 16:58:50 2019 +0000
PinPath: address some feedback + improvements
* Changed client's Pin() API and PinPath to be consistent
* Added helper methods to turn PinPath to query and back
* Make code and tests build
* Use TestCidResolved everywhere
* Fix cluster.PinPath arguments
* Fix formatting of responses with --no-status
* Make tests readable and call Fatal when needed
* Use a pathTestCases variable
commit f0e7369c47c5ddadc8ed45df5fd2d4d9b2d42b38
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Feb 5 18:34:26 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
Addressed review comments as in
https://github.com/ipfs/ipfs-cluster/pull/634#pullrequestreview-198751932
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit a8b4f181d2d7afed32ee41331dfaab19fd66a173
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Jan 29 22:41:27 2019 +0530
Fixing tests
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit e39b95ca19e4d75506f4f492678245ef13936a44
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Jan 29 14:52:53 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
- PinPath and UnpinPath should return api.Pin
- PinPath should accept pin options
- Removing duplicate logic for Resolve from cluster
- And many other review comments https://github.com/ipfs/ipfs-cluster/pull/634#pullrequestreview-195509504
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit d146075126320896665ba58d337a13789f68ea86
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Jan 23 17:08:41 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
PinPath(in both rest and rpc) should return a serializable struct in the
form `{"\":"Q...cid..string..."}` (as used in "github.com/ipfs/go-cid"
to marshal and unmarshal)
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 1f4869568a8adb450275257154ea3a26d03a30f3
Merge: 7acfd28 a244af9
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Jan 23 07:18:56 2019 +0530
Merge branch 'master' into issue_450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 7acfd282732ddf2282a67d4f9d0170a494eb3ed4
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Jan 22 18:14:32 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
- RPC must always use serializable structs
- In command, just use pin with path as cid is also a valid path
- Addressing many other small review comments as in
https://github.com/ipfs/ipfs-cluster/pull/634#pullrequestreview-192122534
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 36905041e1e3f0b204942030aab3ab7b5b9e4d62
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Jan 16 09:36:42 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
Extra logic for path checking should go into resolve so that it can be
properly reused
Added sharness tests
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 9116bda3534e77bb391d873051bb520a1b01a326
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Jan 16 08:08:07 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
error strings should not be capitalized
Fixes #450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit ca7e61861374f456300a85ddc0374e594f74f963
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Jan 15 23:40:25 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
Tests
Fixes #450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 522fbcd899f01c01680375561a32a87464157c0a
Merge: f1a56ab f7bc468
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Jan 15 10:40:54 2019 +0530
Merge branch 'master' into issue_450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit f1a56ab925fb74c0c44273a4524afa4843cf757f
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Mon Jan 14 20:58:17 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
- IPFS Connector should act as a pure IPFS client, any extra logic
should go to cluster.go
- Use cid.Undef, instead of cid.Cid{}
Fixes #450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit c83b91054f6774f1f9d4930cfc3f1fa28236f57c
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Thu Jan 10 08:57:17 2019 +0530
Support PinPath, UnpinPath(resolve before pinning)
- Separate handlers, methods and rpc apis for PinPath and UnpinPath from
Pin and Unpin
- Support ipld paths as well
Fixes #450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 719dff88129366ce3ccb5e04cb6f8082a0915c5c
Merge: 91ceb47 21170c4
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Jan 9 19:38:35 2019 +0530
Merge branch 'issue_450_old' into HEAD
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 91ceb4796259ca7ef2974ec43e6a278a12796b13
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Wed Jan 9 19:36:41 2019 +0530
Revert "WIP: Figure out why test does not impleme"
This reverts commit 28a3a3f25dce6f296c8cbef86221644c099a7e75.
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
commit 28a3a3f25dce6f296c8cbef86221644c099a7e75
Author: cd10012 <ced361@nyu.edu>
Date: Tue Jul 24 23:23:10 2018 -0400
WIP: Figure out why test does not implement IPFSConnector interface...
License: MIT
Signed-off-by: cd10012 <ced361@nyu.edu>
commit 21170c48e77e69583db64544b08120a9baf40d8d
Author: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Date: Tue Jan 8 10:37:59 2019 +0530
Support PinPath, UnpinPath (resolve before pinning)
This commit adds API support for pinning using path
`POST /pins/<ipfs or ipns path>` and `DELETE /pins/<ipfs or ipns path>`
will resolve the path into a cid and perform perform pinning or
unpinning
Fixes #450
License: MIT
Signed-off-by: Kishan Mohanbhai Sagathiya <kishansagathiya@gmail.com>
Co-authored-by: Hector Sanjuan <hector@protocol.ai>
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2019-02-20 11:07:50 +00:00
|
|
|
status, cerr = globalClient.Status(ctx, pin.Cid, false)
|
2018-03-28 14:04:21 +00:00
|
|
|
}
|
|
|
|
formatResponse(c, status, cerr)
|
|
|
|
}
|
|
|
|
|
|
|
|
func waitFor(
|
2018-09-22 01:00:10 +00:00
|
|
|
ci cid.Cid,
|
2018-03-28 14:04:21 +00:00
|
|
|
target api.TrackerStatus,
|
|
|
|
timeout time.Duration,
|
2019-02-27 17:04:35 +00:00
|
|
|
) (*api.GlobalPinInfo, error) {
|
2018-03-28 14:04:21 +00:00
|
|
|
|
|
|
|
ctx := context.Background()
|
|
|
|
|
|
|
|
if timeout > defaultWaitCheckFreq {
|
|
|
|
var cancel context.CancelFunc
|
|
|
|
ctx, cancel = context.WithTimeout(ctx, timeout)
|
|
|
|
defer cancel()
|
|
|
|
}
|
|
|
|
|
|
|
|
fp := client.StatusFilterParams{
|
|
|
|
Cid: ci,
|
|
|
|
Local: false,
|
|
|
|
Target: target,
|
|
|
|
CheckFreq: defaultWaitCheckFreq,
|
|
|
|
}
|
|
|
|
|
2018-08-30 23:14:06 +00:00
|
|
|
return client.WaitFor(ctx, globalClient, fp)
|
2018-03-28 14:04:21 +00:00
|
|
|
}
|
2018-06-27 04:03:15 +00:00
|
|
|
|
2019-08-26 09:00:45 +00:00
|
|
|
func parseMetadata(metadata []string) map[string]string {
|
|
|
|
metadataMap := make(map[string]string)
|
|
|
|
for _, str := range metadata {
|
2019-08-27 04:02:34 +00:00
|
|
|
parts := strings.SplitN(str, "=", 2)
|
2019-08-26 09:00:45 +00:00
|
|
|
if len(parts) != 2 {
|
|
|
|
checkErr("parsing metadata", errors.New("metadata were not in the format key=value"))
|
|
|
|
}
|
|
|
|
metadataMap[parts[0]] = parts[1]
|
|
|
|
}
|
|
|
|
|
|
|
|
return metadataMap
|
|
|
|
}
|
|
|
|
|
2018-06-27 04:03:15 +00:00
|
|
|
// func setupTracing(config tracingConfig) {
|
|
|
|
// if !config.Enable {
|
|
|
|
// return
|
|
|
|
// }
|
|
|
|
|
|
|
|
// agentEndpointURI := "0.0.0.0:6831"
|
|
|
|
// collectorEndpointURI := "http://0.0.0.0:14268"
|
|
|
|
|
|
|
|
// if config.JaegerAgentEndpoint != "" {
|
|
|
|
// agentEndpointURI = config.JaegerAgentEndpoint
|
|
|
|
// }
|
|
|
|
// if config.JaegerCollectorEndpoint != "" {
|
|
|
|
// collectorEndpointURI = config.JaegerCollectorEndpoint
|
|
|
|
// }
|
|
|
|
|
|
|
|
// je, err := jaeger.NewExporter(jaeger.Options{
|
|
|
|
// AgentEndpoint: agentEndpointURI,
|
|
|
|
// CollectorEndpoint: collectorEndpointURI,
|
|
|
|
// ServiceName: "ipfs-cluster-ctl",
|
|
|
|
// })
|
|
|
|
// if err != nil {
|
|
|
|
// log.Fatalf("Failed to create the Jaeger exporter: %v", err)
|
|
|
|
// }
|
|
|
|
// // Register/enable the trace exporter
|
|
|
|
// trace.RegisterExporter(je)
|
|
|
|
|
|
|
|
// // For demo purposes, set the trace sampling probability to be high
|
|
|
|
// trace.ApplyConfig(trace.Config{DefaultSampler: trace.ProbabilitySampler(1.0)})
|
|
|
|
// }
|