retrieval: Fix lint, cli docsgen
This commit is contained in:
parent
ec2bfb99bb
commit
597b72e286
@ -5,8 +5,6 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/multiformats/go-multiaddr"
|
||||
manet "github.com/multiformats/go-multiaddr/net"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
@ -16,21 +14,24 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/filecoin-project/lotus/node/repo"
|
||||
"github.com/ipfs/go-blockservice"
|
||||
"github.com/ipfs/go-cid"
|
||||
offline "github.com/ipfs/go-ipfs-exchange-offline"
|
||||
"github.com/ipfs/go-merkledag"
|
||||
carv2 "github.com/ipld/go-car/v2"
|
||||
"github.com/ipld/go-car/v2/blockstore"
|
||||
"github.com/multiformats/go-multiaddr"
|
||||
manet "github.com/multiformats/go-multiaddr/net"
|
||||
"github.com/urfave/cli/v2"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-fil-markets/retrievalmarket"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
|
||||
lapi "github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/node/repo"
|
||||
)
|
||||
|
||||
const DefaultMaxRetrievePrice = "0.01"
|
||||
@ -427,7 +428,7 @@ var clientRetrieveLsCmd = &cli.Command{
|
||||
}
|
||||
|
||||
if len(roots) != 1 {
|
||||
return xerrors.Errorf("expected 1 car root, got %d")
|
||||
return xerrors.Errorf("expected 1 car root, got %d", len(roots))
|
||||
}
|
||||
|
||||
dserv := merkledag.NewDAGService(blockservice.New(cbs, offline.Exchange(cbs)))
|
||||
|
@ -539,10 +539,12 @@ NAME:
|
||||
lotus client retrieve - Retrieve data from network
|
||||
|
||||
USAGE:
|
||||
lotus client retrieve [command options] [dataCid outputPath]
|
||||
lotus client retrieve command [command options] [dataCid outputPath]
|
||||
|
||||
CATEGORY:
|
||||
RETRIEVAL
|
||||
COMMANDS:
|
||||
cat Show data from network
|
||||
ls Show object links
|
||||
help, h Shows a list of commands or help for one command
|
||||
|
||||
OPTIONS:
|
||||
--from value address to send transactions from
|
||||
@ -553,6 +555,33 @@ OPTIONS:
|
||||
--pieceCid value require data to be retrieved from a specific Piece CID
|
||||
--allow-local (default: false)
|
||||
--help, -h show help (default: false)
|
||||
--version, -v print the version (default: false)
|
||||
|
||||
```
|
||||
|
||||
#### lotus client retrieve cat
|
||||
```
|
||||
NAME:
|
||||
lotus client retrieve cat - Show data from network
|
||||
|
||||
USAGE:
|
||||
lotus client retrieve cat [command options] [dataCid]
|
||||
|
||||
OPTIONS:
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
#### lotus client retrieve ls
|
||||
```
|
||||
NAME:
|
||||
lotus client retrieve ls - Show object links
|
||||
|
||||
USAGE:
|
||||
lotus client retrieve ls [command options] [dataCid]
|
||||
|
||||
OPTIONS:
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
||||
|
@ -323,6 +323,7 @@ func (dh *DealHarness) PerformRetrieval(ctx context.Context, deal *cid.Cid, root
|
||||
|
||||
updatesCtx, cancel := context.WithCancel(ctx)
|
||||
updates, err := dh.client.ClientGetRetrievalUpdates(updatesCtx)
|
||||
require.NoError(dh.t, err)
|
||||
|
||||
retrievalRes, err := dh.client.ClientRetrieve(ctx, offers[0].Order(caddr))
|
||||
require.NoError(dh.t, err)
|
||||
|
@ -1042,6 +1042,8 @@ func parseDagSpec(ctx context.Context, root cid.Cid, dsp []api.DagSpec, ds forma
|
||||
rsn = selspec.Node()
|
||||
}
|
||||
|
||||
var newRoot cid.Cid
|
||||
|
||||
if err := utils.TraverseDag(
|
||||
ctx,
|
||||
ds,
|
||||
@ -1059,7 +1061,7 @@ func parseDagSpec(ctx context.Context, root cid.Cid, dsp []api.DagSpec, ds forma
|
||||
// todo: is this a correct assumption
|
||||
// todo: is the n ipld.Node above the node we want as the (sub)root?
|
||||
// todo: how to go from ipld.Node to a cid?
|
||||
out[i].root = root
|
||||
newRoot = root
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -1068,7 +1070,7 @@ func parseDagSpec(ctx context.Context, root cid.Cid, dsp []api.DagSpec, ds forma
|
||||
return xerrors.Errorf("cidlink cast unexpectedly failed on '%s'", p.LastBlock.Link)
|
||||
}
|
||||
|
||||
out[i].root = cidLnk.Cid
|
||||
newRoot = cidLnk.Cid
|
||||
}
|
||||
return nil
|
||||
},
|
||||
@ -1079,6 +1081,8 @@ func parseDagSpec(ctx context.Context, root cid.Cid, dsp []api.DagSpec, ds forma
|
||||
if out[i].root == cid.Undef {
|
||||
return nil, xerrors.Errorf("path selection does not match a node within %s", root)
|
||||
}
|
||||
|
||||
out[i].root = newRoot
|
||||
}
|
||||
|
||||
if spec.DataSelector != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user