feat(markets): update to support car files

Upgrades lotus version of go-fil-markets to its head, which supports car files and handles tracking
of pieces, reducing the size of sectorBlocks
This commit is contained in:
hannahhoward
2020-01-28 14:08:13 -08:00
parent eb4b85aea5
commit 71289b58ff
13 changed files with 238 additions and 329 deletions
+3 -4
View File
@@ -1,7 +1,6 @@
package client
import (
"bytes"
"context"
"errors"
"io"
@@ -155,7 +154,7 @@ func (a *API) ClientFindData(ctx context.Context, root cid.Cid) ([]api.QueryOffe
out := make([]api.QueryOffer, len(peers))
for k, p := range peers {
queryResponse, err := a.Retrieval.Query(ctx, p, root.Bytes(), retrievalmarket.QueryParams{})
queryResponse, err := a.Retrieval.Query(ctx, p, root, retrievalmarket.QueryParams{})
if err != nil {
out[k] = api.QueryOffer{Err: err.Error(), Miner: p.Address, MinerPeerID: p.ID}
} else {
@@ -279,7 +278,7 @@ func (a *API) ClientRetrieve(ctx context.Context, order api.RetrievalOrder, path
retrievalResult := make(chan error, 1)
unsubscribe := a.Retrieval.SubscribeToEvents(func(event retrievalmarket.ClientEvent, state retrievalmarket.ClientDealState) {
if bytes.Equal(state.PieceCID, order.Root.Bytes()) {
if state.PayloadCID.Equals(order.Root) {
switch event {
case retrievalmarket.ClientEventError:
retrievalResult <- xerrors.New("Retrieval Error")
@@ -291,7 +290,7 @@ func (a *API) ClientRetrieve(ctx context.Context, order api.RetrievalOrder, path
a.Retrieval.Retrieve(
ctx,
order.Root.Bytes(),
order.Root,
retrievalmarket.NewParamsV0(types.BigDiv(order.Total, types.NewInt(order.Size)).Int, 0, 0),
utils.ToSharedTokenAmount(order.Total),
order.MinerPeerID,
+2 -1
View File
@@ -7,6 +7,7 @@ import (
"mime"
"net/http"
"os"
"strconv"
"github.com/filecoin-project/lotus/api/apistruct"
@@ -210,7 +211,7 @@ func (sm *StorageMinerAPI) SectorsRefs(context.Context) (map[string][]api.Sealed
}
for k, v := range refs {
out[k.String()] = v
out[strconv.FormatUint(k, 10)] = v
}
return out, nil