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

refactor: venus-share: split-gateway-interfaces-by-role #4788

Merged
merged 1 commit into from
Feb 21, 2022
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
7 changes: 7 additions & 0 deletions venus-shared/api/gateway/v0/market_event.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,17 @@ import (
)

type IMarketEvent interface {
IMarketClient
IMarketServiceProvider
}

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
}

type IMarketServiceProvider interface {
ResponseMarketEvent(ctx context.Context, resp *gtypes.ResponseEvent) error //perm:read
ListenMarketEvent(ctx context.Context, policy *gtypes.MarketRegisterPolicy) (<-chan *gtypes.RequestEvent, error) //perm:read
}
193 changes: 101 additions & 92 deletions venus-shared/api/gateway/v0/method.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,32 @@
# Groups

* [MarketEvent](#MarketEvent)
* [MarketClient](#MarketClient)
* [IsUnsealed](#IsUnsealed)
* [ListMarketConnectionsState](#ListMarketConnectionsState)
* [SectorsUnsealPiece](#SectorsUnsealPiece)
* [MarketServiceProvider](#MarketServiceProvider)
* [ListenMarketEvent](#ListenMarketEvent)
* [ResponseMarketEvent](#ResponseMarketEvent)
* [SectorsUnsealPiece](#SectorsUnsealPiece)
* [ProofEvent](#ProofEvent)
* [ProofClient](#ProofClient)
* [ComputeProof](#ComputeProof)
* [ListConnectedMiners](#ListConnectedMiners)
* [ListMinerConnection](#ListMinerConnection)
* [ProofServiceProvider](#ProofServiceProvider)
* [ListenProofEvent](#ListenProofEvent)
* [ResponseProofEvent](#ResponseProofEvent)
* [WalletEvent](#WalletEvent)
* [AddNewAddress](#AddNewAddress)
* [WalletClient](#WalletClient)
* [ListWalletInfo](#ListWalletInfo)
* [ListWalletInfoByWallet](#ListWalletInfoByWallet)
* [WalletHas](#WalletHas)
* [WalletSign](#WalletSign)
* [WalletServiceProvider](#WalletServiceProvider)
* [AddNewAddress](#AddNewAddress)
* [ListenWalletEvent](#ListenWalletEvent)
* [RemoveAddress](#RemoveAddress)
* [ResponseWalletEvent](#ResponseWalletEvent)
* [SupportNewAccount](#SupportNewAccount)
* [WalletHas](#WalletHas)
* [WalletSign](#WalletSign)

## MarketEvent
## MarketClient

### IsUnsealed

Expand Down Expand Up @@ -81,6 +84,35 @@ Response:
]
```

### SectorsUnsealPiece


Perms: admin

Inputs:
```json
[
"f01234",
{
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
{
"ID": {
"Miner": 1000,
"Number": 9
},
"ProofType": 8
},
10,
1032,
"string value"
]
```

Response: `{}`

## MarketServiceProvider

### ListenMarketEvent


Expand Down Expand Up @@ -122,34 +154,7 @@ Inputs:

Response: `{}`

### SectorsUnsealPiece


Perms: admin

Inputs:
```json
[
"f01234",
{
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
{
"ID": {
"Miner": 1000,
"Number": 9
},
"ProofType": 8
},
10,
1032,
"string value"
]
```

Response: `{}`

## ProofEvent
## ProofClient

### ComputeProof

Expand Down Expand Up @@ -227,6 +232,8 @@ Response:
}
```

## ProofServiceProvider

### ListenProofEvent


Expand Down Expand Up @@ -268,24 +275,7 @@ Inputs:

Response: `{}`

## WalletEvent

### AddNewAddress


Perms: read

Inputs:
```json
[
"e26f1e5c-47f7-4561-a11d-18fab6e748af",
[
"f01234"
]
]
```

Response: `{}`
## WalletClient

### ListWalletInfo

Expand Down Expand Up @@ -350,33 +340,50 @@ Response:
}
```

### ListenWalletEvent
### WalletHas


Perms: read
Perms: admin

Inputs:
```json
[
"string value",
"f01234"
]
```

Response: `true`

### WalletSign


Perms: admin

Inputs:
```json
[
"string value",
"f01234",
"Ynl0ZSBhcnJheQ==",
{
"SupportAccounts": [
"string value"
],
"SignBytes": "Ynl0ZSBhcnJheQ=="
"Type": "message",
"Extra": "Ynl0ZSBhcnJheQ=="
}
]
```

Response:
```json
{
"Id": "e26f1e5c-47f7-4561-a11d-18fab6e748af",
"Method": "string value",
"Payload": "Ynl0ZSBhcnJheQ=="
"Type": 2,
"Data": "Ynl0ZSBhcnJheQ=="
}
```

### RemoveAddress
## WalletServiceProvider

### AddNewAddress


Perms: read
Expand All @@ -393,7 +400,7 @@ Inputs:

Response: `{}`

### ResponseWalletEvent
### ListenWalletEvent


Perms: read
Expand All @@ -402,16 +409,24 @@ Inputs:
```json
[
{
"Id": "e26f1e5c-47f7-4561-a11d-18fab6e748af",
"Payload": "Ynl0ZSBhcnJheQ==",
"Error": "string value"
"SupportAccounts": [
"string value"
],
"SignBytes": "Ynl0ZSBhcnJheQ=="
}
]
```

Response: `{}`
Response:
```json
{
"Id": "e26f1e5c-47f7-4561-a11d-18fab6e748af",
"Method": "string value",
"Payload": "Ynl0ZSBhcnJheQ=="
}
```

### SupportNewAccount
### RemoveAddress


Perms: read
Expand All @@ -420,50 +435,44 @@ Inputs:
```json
[
"e26f1e5c-47f7-4561-a11d-18fab6e748af",
"string value"
[
"f01234"
]
]
```

Response: `{}`

### WalletHas
### ResponseWalletEvent


Perms: admin
Perms: read

Inputs:
```json
[
"string value",
"f01234"
{
"Id": "e26f1e5c-47f7-4561-a11d-18fab6e748af",
"Payload": "Ynl0ZSBhcnJheQ==",
"Error": "string value"
}
]
```

Response: `true`
Response: `{}`

### WalletSign
### SupportNewAccount


Perms: admin
Perms: read

Inputs:
```json
[
"string value",
"f01234",
"Ynl0ZSBhcnJheQ==",
{
"Type": "message",
"Extra": "Ynl0ZSBhcnJheQ=="
}
"e26f1e5c-47f7-4561-a11d-18fab6e748af",
"string value"
]
```

Response:
```json
{
"Type": 2,
"Data": "Ynl0ZSBhcnJheQ=="
}
```
Response: `{}`

7 changes: 7 additions & 0 deletions venus-shared/api/gateway/v0/proof_event.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,17 @@ import (
)

type IProofEvent interface {
IProofClient
IProofServiceProvider
}

type IProofClient interface {
ListConnectedMiners(ctx context.Context) ([]address.Address, error) //perm:admin
ListMinerConnection(ctx context.Context, addr address.Address) (*gtypes.MinerState, error) //perm:admin
ComputeProof(ctx context.Context, miner address.Address, sectorInfos []builtin.SectorInfo, rand abi.PoStRandomness) ([]builtin.PoStProof, error) //perm:admin
}

type IProofServiceProvider interface {
ResponseProofEvent(ctx context.Context, resp *gtypes.ResponseEvent) error //perm:read
ListenProofEvent(ctx context.Context, policy *gtypes.ProofRegisterPolicy) (<-chan *gtypes.RequestEvent, error) //perm:read
}
Loading