Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: market: add query params #5845

Merged
merged 1 commit into from
Mar 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}