From fe6d5ff3a8f19fa4959c22647256c0c1f2c9d9f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Thu, 29 Aug 2019 17:09:34 +0200 Subject: [PATCH] retrieval: resolve some TODOs --- api/api.go | 2 +- chain/deals/client.go | 1 - chain/gen/utils.go | 2 +- node/builder.go | 2 +- node/impl/storminer.go | 4 ++-- node/modules/services.go | 4 ++-- node/modules/storageminer.go | 9 ++++----- retrieval/miner.go | 2 +- retrieval/types.go | 2 +- 9 files changed, 13 insertions(+), 15 deletions(-) diff --git a/api/api.go b/api/api.go index 902fe90d2..6d460f0b2 100644 --- a/api/api.go +++ b/api/api.go @@ -216,7 +216,7 @@ func (o *QueryOffer) Order() RetrievalOrder { } type RetrievalOrder struct { - // TODO: make this loss unixfs specific + // TODO: make this less unixfs specific Root cid.Cid Size uint64 // TODO: support offset diff --git a/chain/deals/client.go b/chain/deals/client.go index 839698406..427565890 100644 --- a/chain/deals/client.go +++ b/chain/deals/client.go @@ -212,7 +212,6 @@ func (c *Client) VerifyParams(ctx context.Context, data cid.Cid) (*actors.PieceI } func (c *Client) Start(ctx context.Context, p ClientDealProposal, vd *actors.PieceInclVoucherData) (cid.Cid, error) { - // TODO: use data proposal := StorageDealProposal{ PieceRef: p.Data, SerializationMode: SerializationUnixFs, diff --git a/chain/gen/utils.go b/chain/gen/utils.go index d94958d45..61d913a85 100644 --- a/chain/gen/utils.go +++ b/chain/gen/utils.go @@ -3,8 +3,8 @@ package gen import ( "context" "fmt" - "github.com/filecoin-project/go-lotus/build" + "github.com/filecoin-project/go-lotus/build" actors "github.com/filecoin-project/go-lotus/chain/actors" "github.com/filecoin-project/go-lotus/chain/address" "github.com/filecoin-project/go-lotus/chain/state" diff --git a/node/builder.go b/node/builder.go index 538a15f9d..0eb594fad 100644 --- a/node/builder.go +++ b/node/builder.go @@ -3,7 +3,6 @@ package node import ( "context" "errors" - "github.com/filecoin-project/go-lotus/retrieval" "reflect" "time" @@ -36,6 +35,7 @@ import ( "github.com/filecoin-project/go-lotus/node/modules/testing" "github.com/filecoin-project/go-lotus/node/repo" "github.com/filecoin-project/go-lotus/paych" + "github.com/filecoin-project/go-lotus/retrieval" "github.com/filecoin-project/go-lotus/retrieval/discovery" "github.com/filecoin-project/go-lotus/storage" "github.com/filecoin-project/go-lotus/storage/sector" diff --git a/node/impl/storminer.go b/node/impl/storminer.go index 41371fa66..8a58f7fd1 100644 --- a/node/impl/storminer.go +++ b/node/impl/storminer.go @@ -3,16 +3,16 @@ package impl import ( "context" "fmt" - "github.com/filecoin-project/go-lotus/build" - "github.com/filecoin-project/go-lotus/storage/sectorblocks" "io" "math/rand" "github.com/filecoin-project/go-lotus/api" + "github.com/filecoin-project/go-lotus/build" "github.com/filecoin-project/go-lotus/chain/address" "github.com/filecoin-project/go-lotus/lib/sectorbuilder" "github.com/filecoin-project/go-lotus/storage" "github.com/filecoin-project/go-lotus/storage/sector" + "github.com/filecoin-project/go-lotus/storage/sectorblocks" ) type StorageMinerAPI struct { diff --git a/node/modules/services.go b/node/modules/services.go index 07528c0e4..658ac5fd8 100644 --- a/node/modules/services.go +++ b/node/modules/services.go @@ -2,8 +2,6 @@ package modules import ( "context" - "github.com/filecoin-project/go-lotus/retrieval/discovery" - "github.com/filecoin-project/go-lotus/storage/sector" "github.com/libp2p/go-libp2p-core/host" inet "github.com/libp2p/go-libp2p-core/network" @@ -15,6 +13,8 @@ import ( "github.com/filecoin-project/go-lotus/chain/sub" "github.com/filecoin-project/go-lotus/node/hello" "github.com/filecoin-project/go-lotus/node/modules/helpers" + "github.com/filecoin-project/go-lotus/retrieval/discovery" + "github.com/filecoin-project/go-lotus/storage/sector" ) func RunHello(mctx helpers.MetricsCtx, lc fx.Lifecycle, h host.Host, svc *hello.Service) { diff --git a/node/modules/storageminer.go b/node/modules/storageminer.go index c3b4ef5b0..5ca2b3a71 100644 --- a/node/modules/storageminer.go +++ b/node/modules/storageminer.go @@ -2,31 +2,30 @@ package modules import ( "context" - "github.com/filecoin-project/go-lotus/build" - "github.com/filecoin-project/go-lotus/retrieval" - "github.com/filecoin-project/go-lotus/storage/sector" "path/filepath" "github.com/ipfs/go-bitswap" "github.com/ipfs/go-bitswap/network" - "github.com/libp2p/go-libp2p-core/routing" - "github.com/ipfs/go-blockservice" "github.com/ipfs/go-datastore" blockstore "github.com/ipfs/go-ipfs-blockstore" "github.com/ipfs/go-merkledag" "github.com/libp2p/go-libp2p-core/host" + "github.com/libp2p/go-libp2p-core/routing" "github.com/mitchellh/go-homedir" "go.uber.org/fx" "github.com/filecoin-project/go-lotus/api" + "github.com/filecoin-project/go-lotus/build" "github.com/filecoin-project/go-lotus/chain/address" "github.com/filecoin-project/go-lotus/chain/deals" "github.com/filecoin-project/go-lotus/lib/sectorbuilder" "github.com/filecoin-project/go-lotus/node/modules/dtypes" "github.com/filecoin-project/go-lotus/node/modules/helpers" "github.com/filecoin-project/go-lotus/node/repo" + "github.com/filecoin-project/go-lotus/retrieval" "github.com/filecoin-project/go-lotus/storage" + "github.com/filecoin-project/go-lotus/storage/sector" ) func minerAddrFromDS(ds dtypes.MetadataDS) (address.Address, error) { diff --git a/retrieval/miner.go b/retrieval/miner.go index 88fba6a46..9bb3f429d 100644 --- a/retrieval/miner.go +++ b/retrieval/miner.go @@ -81,7 +81,7 @@ type handlerDeal struct { size uint64 } -func (m *Miner) HandleDealStream(stream network.Stream) { // TODO: should we block in stream handlers +func (m *Miner) HandleDealStream(stream network.Stream) { defer stream.Close() hnd := &handlerDeal{ diff --git a/retrieval/types.go b/retrieval/types.go index bef07c697..1392a815f 100644 --- a/retrieval/types.go +++ b/retrieval/types.go @@ -49,7 +49,7 @@ type QueryResponse struct { MinPrice types.BigInt } -type Unixfs0Offer struct { +type Unixfs0Offer struct { // UNBORK Root cid.Cid Offset uint64 Size uint64