From 904e8b64120a320b76b3605ff6bb66a5f078f636 Mon Sep 17 00:00:00 2001 From: shannonwells Date: Tue, 31 Mar 2020 15:46:20 -0700 Subject: [PATCH 1/3] rename list deals interface & impls --- storagemarket/impl/client.go | 2 +- storagemarket/impl/provider.go | 2 +- storagemarket/integration_test.go | 6 +++--- storagemarket/types.go | 10 +++++----- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/storagemarket/impl/client.go b/storagemarket/impl/client.go index c23f2b53..17683f8a 100644 --- a/storagemarket/impl/client.go +++ b/storagemarket/impl/client.go @@ -131,7 +131,7 @@ 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 diff --git a/storagemarket/impl/provider.go b/storagemarket/impl/provider.go index ffc149af..cca7caa6 100644 --- a/storagemarket/impl/provider.go +++ b/storagemarket/impl/provider.go @@ -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 diff --git a/storagemarket/integration_test.go b/storagemarket/integration_test.go index 70aa20ac..416d2d69 100644 --- a/storagemarket/integration_test.go +++ b/storagemarket/integration_test.go @@ -118,7 +118,7 @@ func TestMakeDeal(t *testing.T) { 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] @@ -212,7 +212,7 @@ func TestMakeDealOffline(t *testing.T) { 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] @@ -232,7 +232,7 @@ func TestMakeDealOffline(t *testing.T) { 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] diff --git a/storagemarket/types.go b/storagemarket/types.go index ded8d645..c7d9dabe 100644 --- a/storagemarket/types.go +++ b/storagemarket/types.go @@ -275,8 +275,8 @@ type StorageProvider interface { // ListDeals lists on-chain deals associated with this provider ListDeals(ctx context.Context) ([]StorageDeal, error) - // ListIncompleteDeals lists deals that are in progress or rejected - ListIncompleteDeals() ([]MinerDeal, error) + // ListLocalDeals lists deals that are in progress or rejected + ListLocalDeals() ([]MinerDeal, error) // AddStorageCollateral adds storage collateral AddStorageCollateral(ctx context.Context, amount abi.TokenAmount) error @@ -411,10 +411,10 @@ type StorageClient interface { // ListDeals lists on-chain deals associated with this provider 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 that are in progress or rejected + ListLocalDeals(ctx context.Context) ([]ClientDeal, error) - // ListInProgressDeals lists deals that are in progress or rejected + // ListLocalDeals lists deals that are in progress or rejected GetInProgressDeal(ctx context.Context, cid cid.Cid) (ClientDeal, error) // GetAsk returns the current ask for a storage provider From d5c40176deeb4275815d301116562f3aff0a31e6 Mon Sep 17 00:00:00 2001 From: shannonwells Date: Tue, 31 Mar 2020 15:55:06 -0700 Subject: [PATCH 2/3] one more rename --- storagemarket/impl/client.go | 2 +- storagemarket/integration_test.go | 6 +++--- storagemarket/types.go | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/storagemarket/impl/client.go b/storagemarket/impl/client.go index 17683f8a..041c34ff 100644 --- a/storagemarket/impl/client.go +++ b/storagemarket/impl/client.go @@ -139,7 +139,7 @@ func (c *Client) ListLocalDeals(ctx context.Context) ([]storagemarket.ClientDeal 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 diff --git a/storagemarket/integration_test.go b/storagemarket/integration_test.go index 416d2d69..6446b288 100644 --- a/storagemarket/integration_test.go +++ b/storagemarket/integration_test.go @@ -114,7 +114,7 @@ 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) @@ -208,7 +208,7 @@ 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) @@ -228,7 +228,7 @@ 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) diff --git a/storagemarket/types.go b/storagemarket/types.go index c7d9dabe..684eaf66 100644 --- a/storagemarket/types.go +++ b/storagemarket/types.go @@ -414,8 +414,8 @@ type StorageClient interface { // ListLocalDeals lists deals that are in progress or rejected ListLocalDeals(ctx context.Context) ([]ClientDeal, error) - // ListLocalDeals 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) From 2c3f9992d224bc7d791ff6f746ee2111e4740747 Mon Sep 17 00:00:00 2001 From: shannonwells Date: Tue, 31 Mar 2020 16:30:13 -0700 Subject: [PATCH 3/3] update comments --- storagemarket/types.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/storagemarket/types.go b/storagemarket/types.go index 684eaf66..1c0cc2b3 100644 --- a/storagemarket/types.go +++ b/storagemarket/types.go @@ -272,10 +272,10 @@ 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) - // ListLocalDeals lists deals that are in progress or rejected + // ListLocalDeals lists deals processed by this storage provider ListLocalDeals() ([]MinerDeal, error) // AddStorageCollateral adds storage collateral @@ -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 @@ -408,10 +408,10 @@ 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) - // ListLocalDeals lists deals that are in progress or rejected + // ListLocalDeals lists deals initiated by this storage client ListLocalDeals(ctx context.Context) ([]ClientDeal, error) // GetLocalDeal lists deals that are in progress or rejected