Skip to content

Commit

Permalink
rename list deals interface & impls (#174)
Browse files Browse the repository at this point in the history
* rename list deals interface & impls

* one more rename

* update comments
  • Loading branch information
shannonwells authored Apr 1, 2020
1 parent a845406 commit 6f76036
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions storagemarket/impl/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,15 @@ func (c *Client) ListDeals(ctx context.Context, addr address.Address) ([]storage
return c.node.ListClientDeals(ctx, addr, tok)
}

func (c *Client) ListInProgressDeals(ctx context.Context) ([]storagemarket.ClientDeal, error) {
func (c *Client) ListLocalDeals(ctx context.Context) ([]storagemarket.ClientDeal, error) {
var out []storagemarket.ClientDeal
if err := c.statemachines.List(&out); err != nil {
return nil, err
}
return out, nil
}

func (c *Client) GetInProgressDeal(ctx context.Context, cid cid.Cid) (storagemarket.ClientDeal, error) {
func (c *Client) GetLocalDeal(ctx context.Context, cid cid.Cid) (storagemarket.ClientDeal, error) {
var out storagemarket.ClientDeal
if err := c.statemachines.Get(cid).Get(&out); err != nil {
return storagemarket.ClientDeal{}, err
Expand Down
2 changes: 1 addition & 1 deletion storagemarket/impl/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ func (p *Provider) GetStorageCollateral(ctx context.Context) (storagemarket.Bala
return p.spn.GetBalance(ctx, p.actor, tok)
}

func (p *Provider) ListIncompleteDeals() ([]storagemarket.MinerDeal, error) {
func (p *Provider) ListLocalDeals() ([]storagemarket.MinerDeal, error) {
var out []storagemarket.MinerDeal
if err := p.deals.List(&out); err != nil {
return nil, err
Expand Down
12 changes: 6 additions & 6 deletions storagemarket/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,11 @@ func TestMakeDeal(t *testing.T) {

time.Sleep(time.Millisecond * 100)

cd, err := client.GetInProgressDeal(ctx, proposalCid)
cd, err := client.GetLocalDeal(ctx, proposalCid)
assert.NoError(t, err)
assert.Equal(t, cd.State, storagemarket.StorageDealActive)

providerDeals, err := provider.ListIncompleteDeals()
providerDeals, err := provider.ListLocalDeals()
assert.NoError(t, err)

pd := providerDeals[0]
Expand Down Expand Up @@ -208,11 +208,11 @@ func TestMakeDealOffline(t *testing.T) {

time.Sleep(time.Millisecond * 100)

cd, err := client.GetInProgressDeal(ctx, proposalCid)
cd, err := client.GetLocalDeal(ctx, proposalCid)
assert.NoError(t, err)
assert.Equal(t, cd.State, storagemarket.StorageDealValidating)

providerDeals, err := provider.ListIncompleteDeals()
providerDeals, err := provider.ListLocalDeals()
assert.NoError(t, err)

pd := providerDeals[0]
Expand All @@ -228,11 +228,11 @@ func TestMakeDealOffline(t *testing.T) {

time.Sleep(time.Millisecond * 100)

cd, err = client.GetInProgressDeal(ctx, proposalCid)
cd, err = client.GetLocalDeal(ctx, proposalCid)
assert.NoError(t, err)
assert.Equal(t, cd.State, storagemarket.StorageDealActive)

providerDeals, err = provider.ListIncompleteDeals()
providerDeals, err = provider.ListLocalDeals()
assert.NoError(t, err)

pd = providerDeals[0]
Expand Down
18 changes: 9 additions & 9 deletions storagemarket/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,11 +272,11 @@ type StorageProvider interface {
// ListAsks lists current asks
ListAsks(addr address.Address) []*SignedStorageAsk

// ListDeals lists on-chain deals associated with this provider
// ListDeals lists on-chain deals associated with this storage provider
ListDeals(ctx context.Context) ([]StorageDeal, error)

// ListIncompleteDeals lists deals that are in progress or rejected
ListIncompleteDeals() ([]MinerDeal, error)
// ListLocalDeals lists deals processed by this storage provider
ListLocalDeals() ([]MinerDeal, error)

// AddStorageCollateral adds storage collateral
AddStorageCollateral(ctx context.Context, amount abi.TokenAmount) error
Expand Down Expand Up @@ -341,7 +341,7 @@ type StorageClientNode interface {
// GetBalance returns locked/unlocked for a storage participant. Used by both providers and clients.
GetBalance(ctx context.Context, addr address.Address, tok shared.TipSetToken) (Balance, error)

//// ListClientDeals lists all on-chain deals associated with a storage client
// ListClientDeals lists all on-chain deals associated with a storage client
ListClientDeals(ctx context.Context, addr address.Address, tok shared.TipSetToken) ([]StorageDeal, error)

// GetProviderInfo returns information about a single storage provider
Expand Down Expand Up @@ -408,14 +408,14 @@ type StorageClient interface {
// ListProviders queries chain state and returns active storage providers
ListProviders(ctx context.Context) (<-chan StorageProviderInfo, error)

// ListDeals lists on-chain deals associated with this provider
// ListDeals lists on-chain deals associated with this storage client
ListDeals(ctx context.Context, addr address.Address) ([]StorageDeal, error)

// ListInProgressDeals lists deals that are in progress or rejected
ListInProgressDeals(ctx context.Context) ([]ClientDeal, error)
// ListLocalDeals lists deals initiated by this storage client
ListLocalDeals(ctx context.Context) ([]ClientDeal, error)

// ListInProgressDeals lists deals that are in progress or rejected
GetInProgressDeal(ctx context.Context, cid cid.Cid) (ClientDeal, error)
// GetLocalDeal lists deals that are in progress or rejected
GetLocalDeal(ctx context.Context, cid cid.Cid) (ClientDeal, error)

// GetAsk returns the current ask for a storage provider
GetAsk(ctx context.Context, info StorageProviderInfo) (*SignedStorageAsk, error)
Expand Down

0 comments on commit 6f76036

Please sign in to comment.