Address review comments
- Add comment to clarify the reason for loop in testkit - Trim common prefix in state printed in CLI commands for better readability - Upgrade to a tagged release of `go-fil-markets` that includes indexing work; see: https://github.com/filecoin-project/go-fil-markets/pull/673 - Fix typo in CLI usage. - Add comments to note that it is safe to use fx `OnStart` context when starting the provider engine. - Fix string concatenation in error message formatting.
This commit is contained in:
parent
77a954c7c3
commit
769b0f30ef
@ -3,6 +3,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/fatih/color"
|
"github.com/fatih/color"
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
@ -259,10 +260,11 @@ func printTableShards(shards []api.DagstoreShardInfo) error {
|
|||||||
m := map[string]interface{}{
|
m := map[string]interface{}{
|
||||||
"Key": s.Key,
|
"Key": s.Key,
|
||||||
"State": func() string {
|
"State": func() string {
|
||||||
|
trimmedState := strings.TrimPrefix(s.State, "ShardState")
|
||||||
if c, ok := colors[s.State]; ok {
|
if c, ok := colors[s.State]; ok {
|
||||||
return color.New(c).Sprint(s.State)
|
return color.New(c).Sprint(trimmedState)
|
||||||
}
|
}
|
||||||
return s.State
|
return trimmedState
|
||||||
}(),
|
}(),
|
||||||
"Error": s.Error,
|
"Error": s.Error,
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ var indexProvAnnounceCmd = &cli.Command{
|
|||||||
|
|
||||||
var indexProvAnnounceAllCmd = &cli.Command{
|
var indexProvAnnounceAllCmd = &cli.Command{
|
||||||
Name: "announce-all",
|
Name: "announce-all",
|
||||||
Usage: "Announce all active deals to indexers so they can download its indices",
|
Usage: "Announce all active deals to indexers so they can download the indices",
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
&cli.BoolFlag{
|
&cli.BoolFlag{
|
||||||
Name: "color",
|
Name: "color",
|
||||||
|
2
extern/filecoin-ffi
vendored
2
extern/filecoin-ffi
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 5ec5d805c01ea85224f6448dd6c6fa0a2a73c028
|
Subproject commit e660df5616e397b2d8ac316f45ddfa7a44637971
|
2
go.mod
2
go.mod
@ -38,7 +38,7 @@ require (
|
|||||||
github.com/filecoin-project/go-data-transfer v1.14.0
|
github.com/filecoin-project/go-data-transfer v1.14.0
|
||||||
github.com/filecoin-project/go-fil-commcid v0.1.0
|
github.com/filecoin-project/go-fil-commcid v0.1.0
|
||||||
github.com/filecoin-project/go-fil-commp-hashhash v0.1.0
|
github.com/filecoin-project/go-fil-commp-hashhash v0.1.0
|
||||||
github.com/filecoin-project/go-fil-markets v1.19.2-0.20220223141410-2460e15e07a8
|
github.com/filecoin-project/go-fil-markets v1.20.0
|
||||||
github.com/filecoin-project/go-jsonrpc v0.1.5
|
github.com/filecoin-project/go-jsonrpc v0.1.5
|
||||||
github.com/filecoin-project/go-legs v0.3.4
|
github.com/filecoin-project/go-legs v0.3.4
|
||||||
github.com/filecoin-project/go-padreader v0.0.1
|
github.com/filecoin-project/go-padreader v0.0.1
|
||||||
|
4
go.sum
4
go.sum
@ -335,8 +335,8 @@ github.com/filecoin-project/go-fil-commcid v0.1.0 h1:3R4ds1A9r6cr8mvZBfMYxTS88Oq
|
|||||||
github.com/filecoin-project/go-fil-commcid v0.1.0/go.mod h1:Eaox7Hvus1JgPrL5+M3+h7aSPHc0cVqpSxA+TxIEpZQ=
|
github.com/filecoin-project/go-fil-commcid v0.1.0/go.mod h1:Eaox7Hvus1JgPrL5+M3+h7aSPHc0cVqpSxA+TxIEpZQ=
|
||||||
github.com/filecoin-project/go-fil-commp-hashhash v0.1.0 h1:imrrpZWEHRnNqqv0tN7LXep5bFEVOVmQWHJvl2mgsGo=
|
github.com/filecoin-project/go-fil-commp-hashhash v0.1.0 h1:imrrpZWEHRnNqqv0tN7LXep5bFEVOVmQWHJvl2mgsGo=
|
||||||
github.com/filecoin-project/go-fil-commp-hashhash v0.1.0/go.mod h1:73S8WSEWh9vr0fDJVnKADhfIv/d6dCbAGaAGWbdJEI8=
|
github.com/filecoin-project/go-fil-commp-hashhash v0.1.0/go.mod h1:73S8WSEWh9vr0fDJVnKADhfIv/d6dCbAGaAGWbdJEI8=
|
||||||
github.com/filecoin-project/go-fil-markets v1.19.2-0.20220223141410-2460e15e07a8 h1:cuV4t78W8tUgmqvsc6T6qbWuycg7GzPcNsTdAOxrTns=
|
github.com/filecoin-project/go-fil-markets v1.20.0 h1:kP9A2otcRe4mTfL++GF0+d4PoFDI92E38lhM8GXFT9I=
|
||||||
github.com/filecoin-project/go-fil-markets v1.19.2-0.20220223141410-2460e15e07a8/go.mod h1:OeR49x+NPMfZMMgOresxzecMAgUB+lna2kwJABPwnt8=
|
github.com/filecoin-project/go-fil-markets v1.20.0/go.mod h1:OeR49x+NPMfZMMgOresxzecMAgUB+lna2kwJABPwnt8=
|
||||||
github.com/filecoin-project/go-hamt-ipld v0.1.5 h1:uoXrKbCQZ49OHpsTCkrThPNelC4W3LPEk0OrS/ytIBM=
|
github.com/filecoin-project/go-hamt-ipld v0.1.5 h1:uoXrKbCQZ49OHpsTCkrThPNelC4W3LPEk0OrS/ytIBM=
|
||||||
github.com/filecoin-project/go-hamt-ipld v0.1.5/go.mod h1:6Is+ONR5Cd5R6XZoCse1CWaXZc0Hdb/JeX+EQCQzX24=
|
github.com/filecoin-project/go-hamt-ipld v0.1.5/go.mod h1:6Is+ONR5Cd5R6XZoCse1CWaXZc0Hdb/JeX+EQCQzX24=
|
||||||
github.com/filecoin-project/go-hamt-ipld/v2 v2.0.0 h1:b3UDemBYN2HNfk3KOXNuxgTTxlWi3xVvbQP0IT38fvM=
|
github.com/filecoin-project/go-hamt-ipld/v2 v2.0.0 h1:b3UDemBYN2HNfk3KOXNuxgTTxlWi3xVvbQP0IT38fvM=
|
||||||
|
@ -112,6 +112,7 @@ func RunClientTest(t *testing.T, cmds []*lcli.Command, clientNode *TestFullNode)
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
path := filepath.Join(tmpdir, "outfile.dat")
|
path := filepath.Join(tmpdir, "outfile.dat")
|
||||||
|
|
||||||
|
// Wait for client retrieve to succeed.
|
||||||
for {
|
for {
|
||||||
out = clientCLI.RunCmd("client", "retrieve", dataCid.String(), path)
|
out = clientCLI.RunCmd("client", "retrieve", dataCid.String(), path)
|
||||||
fmt.Println("retrieve:\n", out)
|
fmt.Println("retrieve:\n", out)
|
||||||
|
@ -419,7 +419,7 @@ func (w *Wrapper) GetPiecesContainingBlock(blockCID cid.Cid) ([]cid.Cid, error)
|
|||||||
c, err := cid.Parse(k.String())
|
c, err := cid.Parse(k.String())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
prefix := fmt.Sprintf("getting pieces containing block %s:", blockCID)
|
prefix := fmt.Sprintf("getting pieces containing block %s:", blockCID)
|
||||||
return nil, xerrors.Errorf(prefix+" converting shard key %s to piece cid: %w", k, err)
|
return nil, xerrors.Errorf("%s converting shard key %s to piece cid: %w", prefix, k, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
pieceCids = append(pieceCids, c)
|
pieceCids = append(pieceCids, c)
|
||||||
|
@ -54,6 +54,9 @@ func IndexProvider(cfg config.IndexProviderConfig) func(params IdxProv, marketHo
|
|||||||
|
|
||||||
args.Lifecycle.Append(fx.Hook{
|
args.Lifecycle.Append(fx.Hook{
|
||||||
OnStart: func(ctx context.Context) error {
|
OnStart: func(ctx context.Context) error {
|
||||||
|
// Note that the OnStart context is cancelled after startup. Its use in e.Start is
|
||||||
|
// to start up gossipsub publishers and restore cache, all of which are completed
|
||||||
|
// before e.Start returns. Therefore, it is fine to reuse the give context.
|
||||||
if err := e.Start(ctx); err != nil {
|
if err := e.Start(ctx); err != nil {
|
||||||
return xerrors.Errorf("starting indexer provider engine: %w", err)
|
return xerrors.Errorf("starting indexer provider engine: %w", err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user