Skip to content

Commit

Permalink
fix(retrievalmarket): fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
hannahhoward authored and shannonwells committed Jan 8, 2020
1 parent 27813e5 commit 8bfda46
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
4 changes: 2 additions & 2 deletions retrievalmarket/impl/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ func NewProvider(paymentAddress address.Address, node retrievalmarket.RetrievalP
}

// Start begins listening for deals on the given host
func (p *provider) Start() {
p.network.SetDelegate(p)
func (p *provider) Start() error {
return p.network.SetDelegate(p)
}

// V0
Expand Down
15 changes: 9 additions & 6 deletions retrievalmarket/impl/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,16 @@ func TestHandleQueryStream(t *testing.T) {
c := retrievalimpl.NewProvider(expectedAddress, node, net)
c.SetPricePerByte(expectedPricePerByte)
c.SetPaymentInterval(expectedPaymentInterval, expectedPaymentIntervalIncrease)
c.Start()
_ = c.Start()
net.ReceiveQueryStream(qs)
}

t.Run("it works", func(t *testing.T) {
qs := readWriteQueryStream()
qs.WriteQuery(retrievalmarket.Query{
err := qs.WriteQuery(retrievalmarket.Query{
PieceCID: pcid,
})
require.NoError(t, err)
node := newTestRetrievalProviderNode()
node.expectPiece(pcid, expectedSize)

Expand All @@ -72,9 +73,10 @@ func TestHandleQueryStream(t *testing.T) {

t.Run("piece not found", func(t *testing.T) {
qs := readWriteQueryStream()
qs.WriteQuery(retrievalmarket.Query{
err := qs.WriteQuery(retrievalmarket.Query{
PieceCID: pcid,
})
require.NoError(t, err)
node := newTestRetrievalProviderNode()
node.expectMissingPiece(pcid)

Expand All @@ -92,9 +94,10 @@ func TestHandleQueryStream(t *testing.T) {

t.Run("error reading piece", func(t *testing.T) {
qs := readWriteQueryStream()
qs.WriteQuery(retrievalmarket.Query{
err := qs.WriteQuery(retrievalmarket.Query{
PieceCID: pcid,
})
require.NoError(t, err)
node := newTestRetrievalProviderNode()

receiveStreamOnProvider(qs, node)
Expand Down Expand Up @@ -125,10 +128,10 @@ func TestHandleQueryStream(t *testing.T) {
Writer: qWrite,
RespWriter: tut.FailResponseWriter,
})
qs.WriteQuery(retrievalmarket.Query{
err := qs.WriteQuery(retrievalmarket.Query{
PieceCID: pcid,
})

require.NoError(t, err)
node := newTestRetrievalProviderNode()
node.expectPiece(pcid, expectedSize)

Expand Down
3 changes: 2 additions & 1 deletion retrievalmarket/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ type ProviderSubscriber func(event ProviderEvent, state ProviderDealState)
// retrieval operations and monitors deals received and process
type RetrievalProvider interface {
// Start begins listening for deals on the given host
Start()
Start() error

// V0

Expand Down Expand Up @@ -251,6 +251,7 @@ type Query struct {
// QueryParams // V1
}

// QueryUndefined is a query with no values
var QueryUndefined = Query{}

// NewQueryV0 creates a V0 query (which only specifies a piece)
Expand Down

0 comments on commit 8bfda46

Please sign in to comment.