Skip to content

Commit

Permalink
feat: market: add api DagstoreDestroyShards
Browse files Browse the repository at this point in the history
  • Loading branch information
simlecode committed Mar 27, 2023
1 parent 0c81d3d commit 931bc77
Show file tree
Hide file tree
Showing 9 changed files with 85 additions and 0 deletions.
3 changes: 3 additions & 0 deletions venus-shared/api/market/v0/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ type IMarket interface {
// DagstoreGC runs garbage collection on the DAG store.
DagstoreGC(ctx context.Context) ([]market.DagstoreShardResult, error) //perm:admin

// DagstoreDestroyShard destroy shard by key
DagstoreDestroyShard(ctx context.Context, key string) error //perm:admin

MarkDealsAsPacking(ctx context.Context, miner address.Address, deals []abi.DealID) error //perm:write
UpdateDealOnPacking(ctx context.Context, miner address.Address, dealID abi.DealID, sectorid abi.SectorNumber, offset abi.PaddedPieceSize) error //perm:write
UpdateDealStatus(ctx context.Context, miner address.Address, dealID abi.DealID, pieceStatus market.PieceStatus) error //perm:write
Expand Down
16 changes: 16 additions & 0 deletions venus-shared/api/market/v0/method.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ curl http://<ip>:<port>/rpc/v0 -X POST -H "Content-Type: application/json" -H "
* [AddFsPieceStorage](#addfspiecestorage)
* [AddS3PieceStorage](#adds3piecestorage)
* [AssignUnPackedDeals](#assignunpackeddeals)
* [DagstoreDestroyShard](#dagstoredestroyshard)
* [DagstoreGC](#dagstoregc)
* [DagstoreInitializeAll](#dagstoreinitializeall)
* [DagstoreInitializeShard](#dagstoreinitializeshard)
Expand Down Expand Up @@ -272,6 +273,21 @@ Response:
]
```

### DagstoreDestroyShard
DagstoreDestroyShard destroy shard by key


Perms: admin

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

Response: `{}`

### DagstoreGC
DagstoreGC runs garbage collection on the DAG store.

Expand Down
14 changes: 14 additions & 0 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.

4 changes: 4 additions & 0 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.

3 changes: 3 additions & 0 deletions venus-shared/api/market/v1/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ type IMarket interface {
// DagstoreGC runs garbage collection on the DAG store.
DagstoreGC(ctx context.Context) ([]market.DagstoreShardResult, error) //perm:admin

// DagstoreDestroyShard destroy shard by key
DagstoreDestroyShard(ctx context.Context, key string) error //perm:admin

MarkDealsAsPacking(ctx context.Context, miner address.Address, deals []abi.DealID) error //perm:write
UpdateDealOnPacking(ctx context.Context, miner address.Address, dealID abi.DealID, sectorid abi.SectorNumber, offset abi.PaddedPieceSize) error //perm:write
UpdateDealStatus(ctx context.Context, miner address.Address, dealID abi.DealID, pieceStatus market.PieceStatus, dealStatus storagemarket.StorageDealStatus) error //perm:write
Expand Down
16 changes: 16 additions & 0 deletions venus-shared/api/market/v1/method.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ curl http://<ip>:<port>/rpc/v1 -X POST -H "Content-Type: application/json" -H "
* [AddFsPieceStorage](#addfspiecestorage)
* [AddS3PieceStorage](#adds3piecestorage)
* [AssignUnPackedDeals](#assignunpackeddeals)
* [DagstoreDestroyShard](#dagstoredestroyshard)
* [DagstoreGC](#dagstoregc)
* [DagstoreInitializeAll](#dagstoreinitializeall)
* [DagstoreInitializeShard](#dagstoreinitializeshard)
Expand Down Expand Up @@ -273,6 +274,21 @@ Response:
]
```

### DagstoreDestroyShard
DagstoreDestroyShard destroy shard by key


Perms: admin

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

Response: `{}`

### DagstoreGC
DagstoreGC runs garbage collection on the DAG store.

Expand Down
14 changes: 14 additions & 0 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.

4 changes: 4 additions & 0 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.

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

// refer: https://github.com/filecoin-project/dagstore/blob/master/shard_state.go#L37
const (
ShardStateNew = "ShardStateNew"
ShardStateInitializing = "ShardStateInitializing"
ShardStateAvailable = "ShardStateAvailable"
ShardStateServing = "ShardStateServing"
ShardStateRecovering = "ShardStateRecovering"
ShardStateErrored = "ShardStateErrored"
ShardStateUnknown = "ShardStateUnknown"
)

// DagstoreShardInfo is the serialized form of dagstore.DagstoreShardInfo that
// we expose through JSON-RPC to avoid clients having to depend on the
// dagstore lib.
Expand Down

0 comments on commit 931bc77

Please sign in to comment.