From bb5e2acd13926920d01f5b33f152daa763c23e92 Mon Sep 17 00:00:00 2001 From: shannonwells Date: Thu, 9 Jan 2020 16:59:20 -0800 Subject: [PATCH] some updates after rebase with master --- retrievalmarket/impl/client.go | 10 ---------- retrievalmarket/impl/client_test.go | 2 +- retrievalmarket/impl/provider.go | 12 ++---------- retrievalmarket/impl/provider_test.go | 9 +++++---- retrievalmarket/network/libp2p_impl_test.go | 2 -- .../test_network_types.go | 2 +- 6 files changed, 9 insertions(+), 28 deletions(-) rename {retrievalmarket/network/testutil => shared_testutil}/test_network_types.go (99%) diff --git a/retrievalmarket/impl/client.go b/retrievalmarket/impl/client.go index e089785fb..cf7faf172 100644 --- a/retrievalmarket/impl/client.go +++ b/retrievalmarket/impl/client.go @@ -84,16 +84,6 @@ func (c *client) Retrieve(ctx context.Context, pieceCID []byte, params retrieval go func() { evt := retrievalmarket.ClientEventError - //converted, err := cid.Cast(pieceCID) - - /*if err == nil { - err = c.retrieveUnixfs(ctx, converted, tokenamount.Div(totalFunds, params.PricePerByte).Uint64(), totalFunds, miner, clientWallet, minerWallet) - if err == nil { - evt = retrievalmarket.ClientEventComplete - dealState.Status = retrievalmarket.DealStatusCompleted - } - }*/ - c.notifySubscribers(evt, dealState) }() diff --git a/retrievalmarket/impl/client_test.go b/retrievalmarket/impl/client_test.go index 60faefe7b..1f1f3399e 100644 --- a/retrievalmarket/impl/client_test.go +++ b/retrievalmarket/impl/client_test.go @@ -16,9 +16,9 @@ import ( retrievalimpl "github.com/filecoin-project/go-fil-components/retrievalmarket/impl" "github.com/filecoin-project/go-fil-components/retrievalmarket/network" rmnet "github.com/filecoin-project/go-fil-components/retrievalmarket/network" - tut "github.com/filecoin-project/go-fil-components/retrievalmarket/network/testutil" "github.com/filecoin-project/go-fil-components/shared/tokenamount" "github.com/filecoin-project/go-fil-components/shared/types" + tut "github.com/filecoin-project/go-fil-components/shared_testutil" ) func TestClient_Query(t *testing.T) { diff --git a/retrievalmarket/impl/provider.go b/retrievalmarket/impl/provider.go index 721e5bfd2..18525482d 100644 --- a/retrievalmarket/impl/provider.go +++ b/retrievalmarket/impl/provider.go @@ -112,14 +112,6 @@ func (p *provider) ListDeals() map[retrievalmarket.ProviderDealID]retrievalmarke panic("not implemented") } -func writeErr(stream network.Stream, err error) { - log.Errorf("Retrieval deal error: %+v", err) - _ = cborutil.WriteCborRPC(stream, &OldDealResponse{ - Status: Error, - Message: err.Error(), - }) -} - // TODO: Update for https://github.com/filecoin-project/go-retrieval-market-project/issues/8 func (p *provider) HandleQueryStream(stream rmnet.RetrievalQueryStream) { defer stream.Close() @@ -156,7 +148,7 @@ func (p *provider) HandleQueryStream(stream rmnet.RetrievalQueryStream) { } } -type handlerDeal struct { +/* type handlerDeal struct { p *provider stream network.Stream @@ -164,7 +156,7 @@ type handlerDeal struct { open cid.Cid at uint64 size uint64 -} +}*/ // TODO: Update for https://github.com/filecoin-project/go-retrieval-market-project/issues/7 func (p *provider) HandleDealStream(stream rmnet.RetrievalDealStream) { diff --git a/retrievalmarket/impl/provider_test.go b/retrievalmarket/impl/provider_test.go index 38b4ba99a..2e286a802 100644 --- a/retrievalmarket/impl/provider_test.go +++ b/retrievalmarket/impl/provider_test.go @@ -6,15 +6,16 @@ import ( "testing" "github.com/filecoin-project/go-address" + blockstore "github.com/ipfs/go-ipfs-blockstore" + "github.com/libp2p/go-libp2p-core/peer" + "github.com/stretchr/testify/require" + "github.com/filecoin-project/go-fil-components/retrievalmarket" retrievalimpl "github.com/filecoin-project/go-fil-components/retrievalmarket/impl" "github.com/filecoin-project/go-fil-components/retrievalmarket/network" - tut "github.com/filecoin-project/go-fil-components/retrievalmarket/network/testutil" "github.com/filecoin-project/go-fil-components/shared/tokenamount" "github.com/filecoin-project/go-fil-components/shared/types" - blockstore "github.com/ipfs/go-ipfs-blockstore" - "github.com/libp2p/go-libp2p-core/peer" - "github.com/stretchr/testify/require" + tut "github.com/filecoin-project/go-fil-components/shared_testutil" ) func TestHandleQueryStream(t *testing.T) { diff --git a/retrievalmarket/network/libp2p_impl_test.go b/retrievalmarket/network/libp2p_impl_test.go index d5011dfaa..4579993ad 100644 --- a/retrievalmarket/network/libp2p_impl_test.go +++ b/retrievalmarket/network/libp2p_impl_test.go @@ -29,14 +29,12 @@ func (tr *testReceiver) HandleDealStream(s network.RetrievalDealStream) { defer s.Close() if tr.dealStreamHandler != nil { tr.dealStreamHandler(s) - return } } func (tr *testReceiver) HandleQueryStream(s network.RetrievalQueryStream) { defer s.Close() if tr.queryStreamHandler != nil { tr.queryStreamHandler(s) - return } } diff --git a/retrievalmarket/network/testutil/test_network_types.go b/shared_testutil/test_network_types.go similarity index 99% rename from retrievalmarket/network/testutil/test_network_types.go rename to shared_testutil/test_network_types.go index a5c061e27..786161ed9 100644 --- a/retrievalmarket/network/testutil/test_network_types.go +++ b/shared_testutil/test_network_types.go @@ -1,4 +1,4 @@ -package testutil +package shared_testutil import ( "errors"