Skip to content

Commit

Permalink
fix(storagemarket): remove sector id from MinerDeal
Browse files Browse the repository at this point in the history
There is no reason to keep the sector id in the store for provider deals and its complicating
operations
  • Loading branch information
hannahhoward committed Feb 5, 2020
1 parent c611bfc commit 0b36b15
Show file tree
Hide file tree
Showing 14 changed files with 26 additions and 44 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ require (
github.com/multiformats/go-multihash v0.0.10
github.com/polydawn/refmt v0.0.0-20190809202753-05966cbd336a
github.com/stretchr/testify v1.4.0
github.com/whyrusleeping/cbor-gen v0.0.0-20191216205031-b047b6acb3c0
github.com/whyrusleeping/cbor-gen v0.0.0-20200123233031-1cdf64d27158
golang.org/x/net v0.0.0-20190724013045-ca1201d0de80
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543
)
Expand Down
3 changes: 3 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1 h1:Xye71clBPdm5HgqGwUkwhbynsUJZhDbS20FvLhQ2izg=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY=
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
Expand Down Expand Up @@ -528,6 +529,8 @@ github.com/whyrusleeping/cbor-gen v0.0.0-20191212224538-d370462a7e8a h1:xc8sbWMw
github.com/whyrusleeping/cbor-gen v0.0.0-20191212224538-d370462a7e8a/go.mod h1:xdlJQaiqipF0HW+Mzpg7XRM3fWbGvfgFlcppuvlkIvY=
github.com/whyrusleeping/cbor-gen v0.0.0-20191216205031-b047b6acb3c0 h1:efb/4CnrubzNGqQOeHErxyQ6rIsJb7GcgeSDF7fqWeI=
github.com/whyrusleeping/cbor-gen v0.0.0-20191216205031-b047b6acb3c0/go.mod h1:xdlJQaiqipF0HW+Mzpg7XRM3fWbGvfgFlcppuvlkIvY=
github.com/whyrusleeping/cbor-gen v0.0.0-20200123233031-1cdf64d27158 h1:WXhVOwj2USAXB5oMDwRl3piOux2XMV9TANaYxXHdkoE=
github.com/whyrusleeping/cbor-gen v0.0.0-20200123233031-1cdf64d27158/go.mod h1:Xj/M2wWU+QdTdRbu/L/1dIZY8/Wb2K9pAhtroQuxJJI=
github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f h1:jQa4QT2UP9WYv2nzyawpKMOCl+Z/jW7djv2/J50lj9E=
github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f/go.mod h1:p9UJB6dDgdPgMJZs7UjUOdulKyRr9fqkS+6JKAInPy8=
github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 h1:EKhdznlJHPMoKr0XTrX+IlJs1LH3lyx2nfr1dOlZ79k=
Expand Down
4 changes: 2 additions & 2 deletions piecestore/types_cbor_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions retrievalmarket/types_cbor_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions shared/types/ask_cbor_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions shared/types/voucher_cbor_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions storagemarket/impl/client_cbor_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion storagemarket/impl/client_states.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func (c *Client) staged(ctx context.Context, deal ClientDeal) (func(*ClientDeal)
}

func (c *Client) sealing(ctx context.Context, deal ClientDeal) (func(*ClientDeal), error) {
cb := func(_ uint64, err error) {
cb := func(err error) {
select {
case c.updated <- clientDealUpdate{
newState: storagemarket.StorageDealActive,
Expand Down
4 changes: 2 additions & 2 deletions storagemarket/impl/provider_cbor_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 1 addition & 5 deletions storagemarket/impl/provider_states.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ func (p *Provider) publishing(ctx context.Context, deal MinerDeal) (func(*MinerD
ProposalCid: deal.ProposalCid,
State: deal.State,
Ref: deal.Ref,
SectorID: deal.SectorID,
}

dealId, mcid, err := p.spn.PublishDeals(ctx, smDeal)
Expand Down Expand Up @@ -198,15 +197,12 @@ func (p *Provider) staged(ctx context.Context, deal MinerDeal) (func(*MinerDeal)

func (p *Provider) sealing(ctx context.Context, deal MinerDeal) (func(*MinerDeal), error) {
// TODO: consider waiting for seal to happen
cb := func(sectorId uint64, err error) {
cb := func(err error) {
select {
case p.updated <- minerDealUpdate{
newState: storagemarket.StorageDealActive,
id: deal.ProposalCid,
err: err,
mut: func(deal *MinerDeal) {
deal.SectorID = sectorId
},
}:
case <-p.stop:
}
Expand Down
1 change: 0 additions & 1 deletion storagemarket/impl/provider_storagemarket.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ func (p *Provider) ListIncompleteDeals() ([]storagemarket.MinerDeal, error) {
State: deal.State,
Ref: deal.Ref,
DealID: deal.DealID,
SectorID: deal.SectorID,
})
}

Expand Down
4 changes: 2 additions & 2 deletions storagemarket/impl/types_cbor_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions storagemarket/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,7 @@ type MinerDeal struct {

Ref cid.Cid

DealID uint64
SectorID uint64 // Set when sm >= StorageDealStaged
DealID uint64
}

type ClientDeal struct {
Expand Down Expand Up @@ -244,7 +243,7 @@ type StorageProviderNode interface {
LocatePieceForDealWithinSector(ctx context.Context, dealID uint64) (sectorID uint64, offset uint64, length uint64, err error)
}

type DealSectorCommittedCallback func(sectorId uint64, err error)
type DealSectorCommittedCallback func(err error)

// Node dependencies for a StorageClient
type StorageClientNode interface {
Expand Down
23 changes: 4 additions & 19 deletions storagemarket/types_cbor_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0b36b15

Please sign in to comment.