Skip to content

Commit

Permalink
Merge pull request #5845 from filecoin-project/feat/opt-deal-list
Browse files Browse the repository at this point in the history
feat: market: add query params
  • Loading branch information
simlecode authored Mar 21, 2023
2 parents a928287 + ff29ab4 commit 9aa9c8c
Show file tree
Hide file tree
Showing 10 changed files with 91 additions and 28 deletions.
4 changes: 2 additions & 2 deletions venus-shared/api/market/v0/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 21 additions & 2 deletions venus-shared/api/market/v0/method.md
Original file line number Diff line number Diff line change
Expand Up @@ -1570,7 +1570,14 @@ Perms: read
Inputs:
```json
[
"f01234"
{
"Miner": "f01234",
"State": 12,
"Client": "string value",
"DiscardFailedDeal": true,
"Offset": 123,
"Limit": 123
}
]
```

Expand Down Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions venus-shared/api/market/v0/mock/mock_imarket.go

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

10 changes: 5 additions & 5 deletions venus-shared/api/market/v0/proxy_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 venus-shared/api/market/v1/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 21 additions & 2 deletions venus-shared/api/market/v1/method.md
Original file line number Diff line number Diff line change
Expand Up @@ -1570,7 +1570,14 @@ Perms: read
Inputs:
```json
[
"f01234"
{
"Miner": "f01234",
"State": 12,
"Client": "string value",
"DiscardFailedDeal": true,
"Offset": 123,
"Limit": 123
}
]
```

Expand Down Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions venus-shared/api/market/v1/mock/mock_imarket.go

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

10 changes: 5 additions & 5 deletions venus-shared/api/market/v1/proxy_gen.go

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

9 changes: 9 additions & 0 deletions venus-shared/types/market/retrieval.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,12 @@ type RetrievalAsk struct {
PaymentIntervalIncrease uint64
TimeStamp
}

type RetrievalDealQueryParams struct {
Receiver string
DealID abi.DealID
Status *uint64
DiscardFailedDeal bool

Page
}
16 changes: 16 additions & 0 deletions venus-shared/types/market/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
}

0 comments on commit 9aa9c8c

Please sign in to comment.