From 9363190e824068d18a180f195b7dfcbd279967e1 Mon Sep 17 00:00:00 2001 From: hunjixin <1084400399@qq.com> Date: Wed, 6 Jul 2022 15:48:14 +0800 Subject: [PATCH] fix:change dag cmd api permission to admin --- venus-shared/api/market/api.go | 10 +++++----- venus-shared/api/market/method.md | 11 ++++++----- venus-shared/api/market/proxy_gen.go | 10 +++++----- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/venus-shared/api/market/api.go b/venus-shared/api/market/api.go index fb95338d66..5763e56d4c 100644 --- a/venus-shared/api/market/api.go +++ b/venus-shared/api/market/api.go @@ -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. // @@ -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. @@ -123,10 +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) + 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 diff --git a/venus-shared/api/market/method.md b/venus-shared/api/market/method.md index 3e2648b13a..027fdd4c36 100644 --- a/venus-shared/api/market/method.md +++ b/venus-shared/api/market/method.md @@ -241,7 +241,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 @@ -285,7 +285,7 @@ This operation fails if the shard is not in ShardStateNew state. It blocks until initialization finishes. -Perms: write +Perms: admin Inputs: ```json @@ -297,9 +297,10 @@ Inputs: Response: `{}` ### DagstoreInitializeStorage +DagstoreInitializeStorage initializes all pieces in specify storage -Perms: +Perms: admin Inputs: ```json @@ -329,7 +330,7 @@ DagstoreListShards returns information about all shards known to the DAG store. Only available on nodes running the markets subsystem. -Perms: read +Perms: admin Inputs: `[]` @@ -352,7 +353,7 @@ It blocks until recovery finishes. If recovery failed, it returns the error. -Perms: write +Perms: admin Inputs: ```json diff --git a/venus-shared/api/market/proxy_gen.go b/venus-shared/api/market/proxy_gen.go index 952ab5fb8c..46ab60626b 100644 --- a/venus-shared/api/market/proxy_gen.go +++ b/venus-shared/api/market/proxy_gen.go @@ -29,11 +29,11 @@ type IMarketStruct struct { AddS3PieceStorage func(ctx context.Context, readonly bool, endpoit, name, key, secret, token string) error `perm:"admin"` AssignUnPackedDeals func(ctx context.Context, sid abi.SectorID, ssize abi.SectorSize, spec *market.GetDealSpec) ([]*market.DealInfoIncludePath, error) `perm:"write"` DagstoreGC func(ctx context.Context) ([]market.DagstoreShardResult, error) `perm:"admin"` - DagstoreInitializeAll func(ctx context.Context, params market.DagstoreInitializeAllParams) (<-chan market.DagstoreInitializeAllEvent, error) `perm:"write"` - DagstoreInitializeShard func(ctx context.Context, key string) error `perm:"write"` - DagstoreInitializeStorage func(context.Context, string, market.DagstoreInitializeAllParams) (<-chan market.DagstoreInitializeAllEvent, error) `perm:""` - DagstoreListShards func(ctx context.Context) ([]market.DagstoreShardInfo, error) `perm:"read"` - DagstoreRecoverShard func(ctx context.Context, key string) error `perm:"write"` + DagstoreInitializeAll func(ctx context.Context, params market.DagstoreInitializeAllParams) (<-chan market.DagstoreInitializeAllEvent, error) `perm:"admin"` + DagstoreInitializeShard func(ctx context.Context, key string) error `perm:"admin"` + DagstoreInitializeStorage func(context.Context, string, market.DagstoreInitializeAllParams) (<-chan market.DagstoreInitializeAllEvent, error) `perm:"admin"` + DagstoreListShards func(ctx context.Context) ([]market.DagstoreShardInfo, error) `perm:"admin"` + DagstoreRecoverShard func(ctx context.Context, key string) error `perm:"admin"` DealsConsiderOfflineRetrievalDeals func(context.Context) (bool, error) `perm:"admin"` DealsConsiderOfflineStorageDeals func(context.Context) (bool, error) `perm:"admin"` DealsConsiderOnlineRetrievalDeals func(context.Context) (bool, error) `perm:"admin"`