Skip to content

Commit

Permalink
feat: upgrade market-event api
Browse files Browse the repository at this point in the history
  • Loading branch information
diwufeiwen committed Feb 8, 2023
1 parent 95604cc commit fb64fb6
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 9 deletions.
5 changes: 5 additions & 0 deletions venus-devtool/api-gen/example.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,11 @@ func init() {

// used in market
addExample(filestore.Path("/some/path"))
params, _ := json.Marshal(&market.FsTransfer{Path: "/path"})
addExample(&market.Transfer{
Type: market.PiecesTransferFs,
Params: params,
})

clientDataSelector := client.DataSelector("/ipld/a/b/c")
addExample(clientDataSelector)
Expand Down
7 changes: 4 additions & 3 deletions venus-shared/api/gateway/v2/market_event.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (

"github.com/filecoin-project/venus/venus-shared/types"
gtypes "github.com/filecoin-project/venus/venus-shared/types/gateway"
mktypes "github.com/filecoin-project/venus/venus-shared/types/market"
)

type IMarketEvent interface {
Expand All @@ -19,9 +20,9 @@ type IMarketEvent interface {
}

type IMarketClient interface {
ListMarketConnectionsState(ctx context.Context) ([]gtypes.MarketConnectionState, error) //perm:admin
IsUnsealed(ctx context.Context, miner address.Address, pieceCid cid.Cid, sector storage.SectorRef, offset types.PaddedByteIndex, size abi.PaddedPieceSize) (bool, error) //perm:admin
SectorsUnsealPiece(ctx context.Context, miner address.Address, pieceCid cid.Cid, sector storage.SectorRef, offset types.PaddedByteIndex, size abi.PaddedPieceSize, dest string) error //perm:admin
ListMarketConnectionsState(ctx context.Context) ([]gtypes.MarketConnectionState, error) //perm:admin
IsUnsealed(ctx context.Context, miner address.Address, pieceCid cid.Cid, sector storage.SectorRef, offset types.PaddedByteIndex, size abi.PaddedPieceSize) (bool, error) //perm:admin
SectorsUnsealPiece(ctx context.Context, miner address.Address, pieceCid cid.Cid, sector storage.SectorRef, offset types.PaddedByteIndex, size abi.PaddedPieceSize, transfer *mktypes.Transfer) error //perm:admin
}

type IMarketServiceProvider interface {
Expand Down
5 changes: 4 additions & 1 deletion venus-shared/api/gateway/v2/method.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,10 @@ Inputs:
},
10,
1032,
"string value"
{
"Type": "fs",
"Params": "eyJQYXRoIjoiL3BhdGgifQ=="
}
]
```

Expand Down
3 changes: 2 additions & 1 deletion venus-shared/api/gateway/v2/mock/mock_igateway.go

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

9 changes: 5 additions & 4 deletions venus-shared/api/gateway/v2/proxy_gen.go

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

31 changes: 31 additions & 0 deletions venus-shared/types/market/piece_transfer.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package market

const (
PiecesTransferS3 = "s3"
PiecesTransferFs = "fs"
)

type FsTransfer struct {
Path string
}

type S3Transfer struct {
EndPoint string
Bucket string
SubDir string

AccessKey string
SecretKey string
Token string

Key string
}

// Transfer has the parameters for a data transfer
type Transfer struct {
// The type of transfer eg "http"
Type string
// A byte array containing marshalled data specific to the transfer type
// eg a JSON encoded struct { URL: "<url>", Headers: {...} }
Params []byte
}

0 comments on commit fb64fb6

Please sign in to comment.