Skip to content

Commit

Permalink
feat:add new api DagstoreInitializeStorage to load shard from piece s…
Browse files Browse the repository at this point in the history
…torage (#5032)

* feat:add api DagstoreInitializeStorage

* fix:change dag cmd api permission to admin
  • Loading branch information
hunjixin authored Jul 8, 2022
1 parent e14afe4 commit d8da353
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 12 deletions.
11 changes: 7 additions & 4 deletions venus-shared/api/market/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ type IMarket interface {

// DagstoreListShards returns information about all shards known to the
// DAG store. Only available on nodes running the markets subsystem.
DagstoreListShards(ctx context.Context) ([]market.DagstoreShardInfo, error) //perm:read
DagstoreListShards(ctx context.Context) ([]market.DagstoreShardInfo, error) //perm:admin

// DagstoreInitializeShard initializes an uninitialized shard.
//
Expand All @@ -107,14 +107,14 @@ type IMarket interface {
//
// This operation fails if the shard is not in ShardStateNew state.
// It blocks until initialization finishes.
DagstoreInitializeShard(ctx context.Context, key string) error //perm:write
DagstoreInitializeShard(ctx context.Context, key string) error //perm:admin

// DagstoreRecoverShard attempts to recover a failed shard.
//
// This operation fails if the shard is not in ShardStateErrored state.
// It blocks until recovery finishes. If recovery failed, it returns the
// error.
DagstoreRecoverShard(ctx context.Context, key string) error //perm:write
DagstoreRecoverShard(ctx context.Context, key string) error //perm:admin

// DagstoreInitializeAll initializes all uninitialized shards in bulk,
// according to the policy passed in the parameters.
Expand All @@ -123,7 +123,10 @@ type IMarket interface {
// IO pressure if the storage subsystem has a large amount of deals.
//
// It returns a stream of events to report progress.
DagstoreInitializeAll(ctx context.Context, params market.DagstoreInitializeAllParams) (<-chan market.DagstoreInitializeAllEvent, error) //perm:write
DagstoreInitializeAll(ctx context.Context, params market.DagstoreInitializeAllParams) (<-chan market.DagstoreInitializeAllEvent, error) //perm:admin

//DagstoreInitializeStorage initializes all pieces in specify storage
DagstoreInitializeStorage(context.Context, string, market.DagstoreInitializeAllParams) (<-chan market.DagstoreInitializeAllEvent, error) //perm:admin

// DagstoreGC runs garbage collection on the DAG store.
DagstoreGC(ctx context.Context) ([]market.DagstoreShardResult, error) //perm:admin
Expand Down
38 changes: 34 additions & 4 deletions venus-shared/api/market/method.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* [DagstoreGC](#DagstoreGC)
* [DagstoreInitializeAll](#DagstoreInitializeAll)
* [DagstoreInitializeShard](#DagstoreInitializeShard)
* [DagstoreInitializeStorage](#DagstoreInitializeStorage)
* [DagstoreListShards](#DagstoreListShards)
* [DagstoreRecoverShard](#DagstoreRecoverShard)
* [DealsConsiderOfflineRetrievalDeals](#DealsConsiderOfflineRetrievalDeals)
Expand Down Expand Up @@ -242,7 +243,7 @@ IO pressure if the storage subsystem has a large amount of deals.
It returns a stream of events to report progress.


Perms: write
Perms: admin

Inputs:
```json
Expand Down Expand Up @@ -286,7 +287,7 @@ This operation fails if the shard is not in ShardStateNew state.
It blocks until initialization finishes.


Perms: write
Perms: admin

Inputs:
```json
Expand All @@ -297,12 +298,41 @@ Inputs:

Response: `{}`

### DagstoreInitializeStorage
DagstoreInitializeStorage initializes all pieces in specify storage


Perms: admin

Inputs:
```json
[
"string value",
{
"MaxConcurrency": 123,
"IncludeSealed": true
}
]
```

Response:
```json
{
"Key": "string value",
"Event": "string value",
"Success": true,
"Error": "string value",
"Total": 123,
"Current": 123
}
```

### DagstoreListShards
DagstoreListShards returns information about all shards known to the
DAG store. Only available on nodes running the markets subsystem.


Perms: read
Perms: admin

Inputs: `[]`

Expand All @@ -325,7 +355,7 @@ It blocks until recovery finishes. If recovery failed, it returns the
error.


Perms: write
Perms: admin

Inputs:
```json
Expand Down
15 changes: 15 additions & 0 deletions venus-shared/api/market/mock/mock_imarket.go

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

12 changes: 8 additions & 4 deletions venus-shared/api/market/proxy_gen.go

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

0 comments on commit d8da353

Please sign in to comment.