diff --git a/venus-shared/api/market/v0/api.go b/venus-shared/api/market/v0/api.go index 52e4b17546..675c88251b 100644 --- a/venus-shared/api/market/v0/api.go +++ b/venus-shared/api/market/v0/api.go @@ -32,10 +32,10 @@ type IMarket interface { MarketImportPublishedDeal(ctx context.Context, deal market.MinerDeal) error //perm:write MarketListDeals(ctx context.Context, addrs []address.Address) ([]*types.MarketDeal, error) //perm:read MarketGetDeal(ctx context.Context, dealPropCid cid.Cid) (*market.MinerDeal, error) //perm:read - MarketListRetrievalDeals(ctx context.Context) ([]market.ProviderDealState, error) //perm:read + MarketListRetrievalDeals(ctx context.Context, params *market.RetrievalDealQueryParams) ([]market.ProviderDealState, error) //perm:read MarketGetRetrievalDeal(ctx context.Context, receiver peer.ID, dealID uint64) (*market.ProviderDealState, error) //perm:read MarketGetDealUpdates(ctx context.Context) (<-chan market.MinerDeal, error) //perm:admin - MarketListIncompleteDeals(ctx context.Context, mAddr address.Address) ([]market.MinerDeal, error) //perm:read + MarketListIncompleteDeals(ctx context.Context, params *market.StorageDealQueryParams) ([]market.MinerDeal, error) //perm:read MarketSetAsk(ctx context.Context, mAddr address.Address, price types.BigInt, verifiedPrice types.BigInt, duration abi.ChainEpoch, minPieceSize abi.PaddedPieceSize, maxPieceSize abi.PaddedPieceSize) error //perm:admin MarketGetAsk(ctx context.Context, mAddr address.Address) (*market.SignedStorageAsk, error) //perm:read MarketListStorageAsk(ctx context.Context) ([]*market.SignedStorageAsk, error) //perm:read diff --git a/venus-shared/api/market/v0/method.md b/venus-shared/api/market/v0/method.md index 1df1594771..4c88ecd4c9 100644 --- a/venus-shared/api/market/v0/method.md +++ b/venus-shared/api/market/v0/method.md @@ -1570,7 +1570,14 @@ Perms: read Inputs: ```json [ - "f01234" + { + "Miner": "f01234", + "State": 12, + "Client": "string value", + "DiscardFailedDeal": true, + "Offset": 123, + "Limit": 123 + } ] ``` @@ -1672,7 +1679,19 @@ Response: Perms: read -Inputs: `[]` +Inputs: +```json +[ + { + "Receiver": "string value", + "DealID": 5432, + "Status": 12, + "DiscardFailedDeal": true, + "Offset": 123, + "Limit": 123 + } +] +``` Response: ```json diff --git a/venus-shared/api/market/v0/mock/mock_imarket.go b/venus-shared/api/market/v0/mock/mock_imarket.go index 111112c54e..f12e0fcfeb 100644 --- a/venus-shared/api/market/v0/mock/mock_imarket.go +++ b/venus-shared/api/market/v0/mock/mock_imarket.go @@ -912,7 +912,7 @@ func (mr *MockIMarketMockRecorder) MarketListDeals(arg0, arg1 interface{}) *gomo } // MarketListIncompleteDeals mocks base method. -func (m *MockIMarket) MarketListIncompleteDeals(arg0 context.Context, arg1 address.Address) ([]market.MinerDeal, error) { +func (m *MockIMarket) MarketListIncompleteDeals(arg0 context.Context, arg1 *market.StorageDealQueryParams) ([]market.MinerDeal, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "MarketListIncompleteDeals", arg0, arg1) ret0, _ := ret[0].([]market.MinerDeal) @@ -942,18 +942,18 @@ func (mr *MockIMarketMockRecorder) MarketListRetrievalAsk(arg0 interface{}) *gom } // MarketListRetrievalDeals mocks base method. -func (m *MockIMarket) MarketListRetrievalDeals(arg0 context.Context) ([]market.ProviderDealState, error) { +func (m *MockIMarket) MarketListRetrievalDeals(arg0 context.Context, arg1 *market.RetrievalDealQueryParams) ([]market.ProviderDealState, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "MarketListRetrievalDeals", arg0) + ret := m.ctrl.Call(m, "MarketListRetrievalDeals", arg0, arg1) ret0, _ := ret[0].([]market.ProviderDealState) ret1, _ := ret[1].(error) return ret0, ret1 } // MarketListRetrievalDeals indicates an expected call of MarketListRetrievalDeals. -func (mr *MockIMarketMockRecorder) MarketListRetrievalDeals(arg0 interface{}) *gomock.Call { +func (mr *MockIMarketMockRecorder) MarketListRetrievalDeals(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MarketListRetrievalDeals", reflect.TypeOf((*MockIMarket)(nil).MarketListRetrievalDeals), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MarketListRetrievalDeals", reflect.TypeOf((*MockIMarket)(nil).MarketListRetrievalDeals), arg0, arg1) } // MarketListStorageAsk mocks base method. diff --git a/venus-shared/api/market/v0/proxy_gen.go b/venus-shared/api/market/v0/proxy_gen.go index b7dd89995f..79f5ce79a0 100644 --- a/venus-shared/api/market/v0/proxy_gen.go +++ b/venus-shared/api/market/v0/proxy_gen.go @@ -81,9 +81,9 @@ type IMarketStruct struct { MarketImportPublishedDeal func(ctx context.Context, deal market.MinerDeal) error `perm:"write"` MarketListDataTransfers func(ctx context.Context) ([]market.DataTransferChannel, error) `perm:"admin"` MarketListDeals func(ctx context.Context, addrs []address.Address) ([]*types.MarketDeal, error) `perm:"read"` - MarketListIncompleteDeals func(ctx context.Context, mAddr address.Address) ([]market.MinerDeal, error) `perm:"read"` + MarketListIncompleteDeals func(ctx context.Context, params *market.StorageDealQueryParams) ([]market.MinerDeal, error) `perm:"read"` MarketListRetrievalAsk func(ctx context.Context) ([]*market.RetrievalAsk, error) `perm:"read"` - MarketListRetrievalDeals func(ctx context.Context) ([]market.ProviderDealState, error) `perm:"read"` + MarketListRetrievalDeals func(ctx context.Context, params *market.RetrievalDealQueryParams) ([]market.ProviderDealState, error) `perm:"read"` MarketListStorageAsk func(ctx context.Context) ([]*market.SignedStorageAsk, error) `perm:"read"` MarketMaxBalanceAddFee func(context.Context, address.Address) (types.FIL, error) `perm:"read"` MarketMaxDealsPerPublishMsg func(context.Context, address.Address) (uint64, error) `perm:"read"` @@ -294,14 +294,14 @@ func (s *IMarketStruct) MarketListDataTransfers(p0 context.Context) ([]market.Da func (s *IMarketStruct) MarketListDeals(p0 context.Context, p1 []address.Address) ([]*types.MarketDeal, error) { return s.Internal.MarketListDeals(p0, p1) } -func (s *IMarketStruct) MarketListIncompleteDeals(p0 context.Context, p1 address.Address) ([]market.MinerDeal, error) { +func (s *IMarketStruct) MarketListIncompleteDeals(p0 context.Context, p1 *market.StorageDealQueryParams) ([]market.MinerDeal, error) { return s.Internal.MarketListIncompleteDeals(p0, p1) } func (s *IMarketStruct) MarketListRetrievalAsk(p0 context.Context) ([]*market.RetrievalAsk, error) { return s.Internal.MarketListRetrievalAsk(p0) } -func (s *IMarketStruct) MarketListRetrievalDeals(p0 context.Context) ([]market.ProviderDealState, error) { - return s.Internal.MarketListRetrievalDeals(p0) +func (s *IMarketStruct) MarketListRetrievalDeals(p0 context.Context, p1 *market.RetrievalDealQueryParams) ([]market.ProviderDealState, error) { + return s.Internal.MarketListRetrievalDeals(p0, p1) } func (s *IMarketStruct) MarketListStorageAsk(p0 context.Context) ([]*market.SignedStorageAsk, error) { return s.Internal.MarketListStorageAsk(p0) diff --git a/venus-shared/api/market/v1/api.go b/venus-shared/api/market/v1/api.go index 4f9048b9e8..9c25f68abf 100644 --- a/venus-shared/api/market/v1/api.go +++ b/venus-shared/api/market/v1/api.go @@ -32,10 +32,10 @@ type IMarket interface { MarketImportPublishedDeal(ctx context.Context, deal market.MinerDeal) error //perm:write MarketListDeals(ctx context.Context, addrs []address.Address) ([]*types.MarketDeal, error) //perm:read MarketGetDeal(ctx context.Context, dealPropCid cid.Cid) (*market.MinerDeal, error) //perm:read - MarketListRetrievalDeals(ctx context.Context) ([]market.ProviderDealState, error) //perm:read + MarketListRetrievalDeals(ctx context.Context, params *market.RetrievalDealQueryParams) ([]market.ProviderDealState, error) //perm:read MarketGetRetrievalDeal(ctx context.Context, receiver peer.ID, dealID uint64) (*market.ProviderDealState, error) //perm:read MarketGetDealUpdates(ctx context.Context) (<-chan market.MinerDeal, error) //perm:admin - MarketListIncompleteDeals(ctx context.Context, mAddr address.Address) ([]market.MinerDeal, error) //perm:read + MarketListIncompleteDeals(ctx context.Context, params *market.StorageDealQueryParams) ([]market.MinerDeal, error) //perm:read MarketSetAsk(ctx context.Context, mAddr address.Address, price types.BigInt, verifiedPrice types.BigInt, duration abi.ChainEpoch, minPieceSize abi.PaddedPieceSize, maxPieceSize abi.PaddedPieceSize) error //perm:admin MarketGetAsk(ctx context.Context, mAddr address.Address) (*market.SignedStorageAsk, error) //perm:read MarketListStorageAsk(ctx context.Context) ([]*market.SignedStorageAsk, error) //perm:read diff --git a/venus-shared/api/market/v1/method.md b/venus-shared/api/market/v1/method.md index bc0d4a5fdb..e90d2be39f 100644 --- a/venus-shared/api/market/v1/method.md +++ b/venus-shared/api/market/v1/method.md @@ -1570,7 +1570,14 @@ Perms: read Inputs: ```json [ - "f01234" + { + "Miner": "f01234", + "State": 12, + "Client": "string value", + "DiscardFailedDeal": true, + "Offset": 123, + "Limit": 123 + } ] ``` @@ -1672,7 +1679,19 @@ Response: Perms: read -Inputs: `[]` +Inputs: +```json +[ + { + "Receiver": "string value", + "DealID": 5432, + "Status": 12, + "DiscardFailedDeal": true, + "Offset": 123, + "Limit": 123 + } +] +``` Response: ```json diff --git a/venus-shared/api/market/v1/mock/mock_imarket.go b/venus-shared/api/market/v1/mock/mock_imarket.go index a819a6dd30..df2f3485e6 100644 --- a/venus-shared/api/market/v1/mock/mock_imarket.go +++ b/venus-shared/api/market/v1/mock/mock_imarket.go @@ -912,7 +912,7 @@ func (mr *MockIMarketMockRecorder) MarketListDeals(arg0, arg1 interface{}) *gomo } // MarketListIncompleteDeals mocks base method. -func (m *MockIMarket) MarketListIncompleteDeals(arg0 context.Context, arg1 address.Address) ([]market.MinerDeal, error) { +func (m *MockIMarket) MarketListIncompleteDeals(arg0 context.Context, arg1 *market.StorageDealQueryParams) ([]market.MinerDeal, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "MarketListIncompleteDeals", arg0, arg1) ret0, _ := ret[0].([]market.MinerDeal) @@ -942,18 +942,18 @@ func (mr *MockIMarketMockRecorder) MarketListRetrievalAsk(arg0 interface{}) *gom } // MarketListRetrievalDeals mocks base method. -func (m *MockIMarket) MarketListRetrievalDeals(arg0 context.Context) ([]market.ProviderDealState, error) { +func (m *MockIMarket) MarketListRetrievalDeals(arg0 context.Context, arg1 *market.RetrievalDealQueryParams) ([]market.ProviderDealState, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "MarketListRetrievalDeals", arg0) + ret := m.ctrl.Call(m, "MarketListRetrievalDeals", arg0, arg1) ret0, _ := ret[0].([]market.ProviderDealState) ret1, _ := ret[1].(error) return ret0, ret1 } // MarketListRetrievalDeals indicates an expected call of MarketListRetrievalDeals. -func (mr *MockIMarketMockRecorder) MarketListRetrievalDeals(arg0 interface{}) *gomock.Call { +func (mr *MockIMarketMockRecorder) MarketListRetrievalDeals(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MarketListRetrievalDeals", reflect.TypeOf((*MockIMarket)(nil).MarketListRetrievalDeals), arg0) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MarketListRetrievalDeals", reflect.TypeOf((*MockIMarket)(nil).MarketListRetrievalDeals), arg0, arg1) } // MarketListStorageAsk mocks base method. diff --git a/venus-shared/api/market/v1/proxy_gen.go b/venus-shared/api/market/v1/proxy_gen.go index 2119776a2d..6439124bb2 100644 --- a/venus-shared/api/market/v1/proxy_gen.go +++ b/venus-shared/api/market/v1/proxy_gen.go @@ -81,9 +81,9 @@ type IMarketStruct struct { MarketImportPublishedDeal func(ctx context.Context, deal market.MinerDeal) error `perm:"write"` MarketListDataTransfers func(ctx context.Context) ([]market.DataTransferChannel, error) `perm:"admin"` MarketListDeals func(ctx context.Context, addrs []address.Address) ([]*types.MarketDeal, error) `perm:"read"` - MarketListIncompleteDeals func(ctx context.Context, mAddr address.Address) ([]market.MinerDeal, error) `perm:"read"` + MarketListIncompleteDeals func(ctx context.Context, params *market.StorageDealQueryParams) ([]market.MinerDeal, error) `perm:"read"` MarketListRetrievalAsk func(ctx context.Context) ([]*market.RetrievalAsk, error) `perm:"read"` - MarketListRetrievalDeals func(ctx context.Context) ([]market.ProviderDealState, error) `perm:"read"` + MarketListRetrievalDeals func(ctx context.Context, params *market.RetrievalDealQueryParams) ([]market.ProviderDealState, error) `perm:"read"` MarketListStorageAsk func(ctx context.Context) ([]*market.SignedStorageAsk, error) `perm:"read"` MarketMaxBalanceAddFee func(context.Context, address.Address) (types.FIL, error) `perm:"read"` MarketMaxDealsPerPublishMsg func(context.Context, address.Address) (uint64, error) `perm:"read"` @@ -294,14 +294,14 @@ func (s *IMarketStruct) MarketListDataTransfers(p0 context.Context) ([]market.Da func (s *IMarketStruct) MarketListDeals(p0 context.Context, p1 []address.Address) ([]*types.MarketDeal, error) { return s.Internal.MarketListDeals(p0, p1) } -func (s *IMarketStruct) MarketListIncompleteDeals(p0 context.Context, p1 address.Address) ([]market.MinerDeal, error) { +func (s *IMarketStruct) MarketListIncompleteDeals(p0 context.Context, p1 *market.StorageDealQueryParams) ([]market.MinerDeal, error) { return s.Internal.MarketListIncompleteDeals(p0, p1) } func (s *IMarketStruct) MarketListRetrievalAsk(p0 context.Context) ([]*market.RetrievalAsk, error) { return s.Internal.MarketListRetrievalAsk(p0) } -func (s *IMarketStruct) MarketListRetrievalDeals(p0 context.Context) ([]market.ProviderDealState, error) { - return s.Internal.MarketListRetrievalDeals(p0) +func (s *IMarketStruct) MarketListRetrievalDeals(p0 context.Context, p1 *market.RetrievalDealQueryParams) ([]market.ProviderDealState, error) { + return s.Internal.MarketListRetrievalDeals(p0, p1) } func (s *IMarketStruct) MarketListStorageAsk(p0 context.Context) ([]*market.SignedStorageAsk, error) { return s.Internal.MarketListStorageAsk(p0) diff --git a/venus-shared/types/market/retrieval.go b/venus-shared/types/market/retrieval.go index 7bf797a0e7..2ab15aeb22 100644 --- a/venus-shared/types/market/retrieval.go +++ b/venus-shared/types/market/retrieval.go @@ -56,3 +56,12 @@ type RetrievalAsk struct { PaymentIntervalIncrease uint64 TimeStamp } + +type RetrievalDealQueryParams struct { + Receiver string + DealID abi.DealID + Status *uint64 + DiscardFailedDeal bool + + Page +} diff --git a/venus-shared/types/market/storage.go b/venus-shared/types/market/storage.go index 4d04a873b9..9d30e3f700 100644 --- a/venus-shared/types/market/storage.go +++ b/venus-shared/types/market/storage.go @@ -3,6 +3,7 @@ package market import ( "time" + "github.com/filecoin-project/go-address" datatransfer "github.com/filecoin-project/go-data-transfer" "github.com/filecoin-project/go-fil-markets/filestore" "github.com/filecoin-project/go-fil-markets/retrievalmarket" @@ -108,3 +109,18 @@ func (sa *SignedStorageAsk) ToChainAsk() *storagemarket.SignedStorageAsk { Signature: sa.Signature, } } + +type Page struct { + Offset int + Limit int +} + +type StorageDealQueryParams struct { + // provider + Miner address.Address + State *uint64 + Client string + DiscardFailedDeal bool + + Page +}