[#976] control: Introduce new method RemoveChainLocalOverridesByTarget
Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
This commit is contained in:
parent
2d595ec15f
commit
5ee5f1df42
6 changed files with 82 additions and 20 deletions
|
@ -8,26 +8,27 @@ import (
|
||||||
const serviceName = "control.ControlService"
|
const serviceName = "control.ControlService"
|
||||||
|
|
||||||
const (
|
const (
|
||||||
rpcHealthCheck = "HealthCheck"
|
rpcHealthCheck = "HealthCheck"
|
||||||
rpcSetNetmapStatus = "SetNetmapStatus"
|
rpcSetNetmapStatus = "SetNetmapStatus"
|
||||||
rpcDropObjects = "DropObjects"
|
rpcDropObjects = "DropObjects"
|
||||||
rpcListShards = "ListShards"
|
rpcListShards = "ListShards"
|
||||||
rpcSetShardMode = "SetShardMode"
|
rpcSetShardMode = "SetShardMode"
|
||||||
rpcSynchronizeTree = "SynchronizeTree"
|
rpcSynchronizeTree = "SynchronizeTree"
|
||||||
rpcEvacuateShard = "EvacuateShard"
|
rpcEvacuateShard = "EvacuateShard"
|
||||||
rpcStartShardEvacuation = "StartShardEvacuation"
|
rpcStartShardEvacuation = "StartShardEvacuation"
|
||||||
rpcGetShardEvacuationStatus = "GetShardEvacuationStatus"
|
rpcGetShardEvacuationStatus = "GetShardEvacuationStatus"
|
||||||
rpcResetShardEvacuationStatus = "ResetShardEvacuationStatus"
|
rpcResetShardEvacuationStatus = "ResetShardEvacuationStatus"
|
||||||
rpcStopShardEvacuation = "StopShardEvacuation"
|
rpcStopShardEvacuation = "StopShardEvacuation"
|
||||||
rpcFlushCache = "FlushCache"
|
rpcFlushCache = "FlushCache"
|
||||||
rpcDoctor = "Doctor"
|
rpcDoctor = "Doctor"
|
||||||
rpcAddChainLocalOverride = "AddChainLocalOverride"
|
rpcAddChainLocalOverride = "AddChainLocalOverride"
|
||||||
rpcGetChainLocalOverride = "GetChainLocalOverride"
|
rpcGetChainLocalOverride = "GetChainLocalOverride"
|
||||||
rpcListChainLocalOverrides = "ListChainLocalOverrides"
|
rpcListChainLocalOverrides = "ListChainLocalOverrides"
|
||||||
rpcRemoveChainLocalOverride = "RemoveChainLocalOverride"
|
rpcRemoveChainLocalOverride = "RemoveChainLocalOverride"
|
||||||
rpcSealWriteCache = "SealWriteCache"
|
rpcRemoveChainLocalOverridesByTarget = "RemoveChainLocalOverridesByTarget"
|
||||||
rpcListTargetsLocalOverrides = "ListTargetsLocalOverrides"
|
rpcSealWriteCache = "SealWriteCache"
|
||||||
rpcDetachShards = "DetachShards"
|
rpcListTargetsLocalOverrides = "ListTargetsLocalOverrides"
|
||||||
|
rpcDetachShards = "DetachShards"
|
||||||
)
|
)
|
||||||
|
|
||||||
// HealthCheck executes ControlService.HealthCheck RPC.
|
// HealthCheck executes ControlService.HealthCheck RPC.
|
||||||
|
@ -295,6 +296,19 @@ func RemoveChainLocalOverride(cli *client.Client, req *RemoveChainLocalOverrideR
|
||||||
return wResp.message, nil
|
return wResp.message, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RemoveChainLocalOverridesByTarget executes ControlService.RemoveChainLocalOverridesByTarget RPC.
|
||||||
|
func RemoveChainLocalOverridesByTarget(cli *client.Client, req *RemoveChainLocalOverridesByTargetRequest, opts ...client.CallOption) (*RemoveChainLocalOverridesByTargetResponse, error) {
|
||||||
|
wResp := newResponseWrapper[RemoveChainLocalOverridesByTargetResponse]()
|
||||||
|
wReq := &requestWrapper{m: req}
|
||||||
|
|
||||||
|
err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceName, rpcRemoveChainLocalOverridesByTarget), wReq, wResp, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return wResp.message, nil
|
||||||
|
}
|
||||||
|
|
||||||
// SealWriteCache executes ControlService.SealWriteCache RPC.
|
// SealWriteCache executes ControlService.SealWriteCache RPC.
|
||||||
func SealWriteCache(cli *client.Client, req *SealWriteCacheRequest, opts ...client.CallOption) (*SealWriteCacheResponse, error) {
|
func SealWriteCache(cli *client.Client, req *SealWriteCacheRequest, opts ...client.CallOption) (*SealWriteCacheResponse, error) {
|
||||||
wResp := newResponseWrapper[SealWriteCacheResponse]()
|
wResp := newResponseWrapper[SealWriteCacheResponse]()
|
||||||
|
|
|
@ -174,6 +174,31 @@ func (s *Server) RemoveChainLocalOverride(_ context.Context, req *control.Remove
|
||||||
return resp, nil
|
return resp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *Server) RemoveChainLocalOverridesByTarget(_ context.Context, req *control.RemoveChainLocalOverridesByTargetRequest) (*control.RemoveChainLocalOverridesByTargetResponse, error) {
|
||||||
|
if err := s.isValidRequest(req); err != nil {
|
||||||
|
return nil, status.Error(codes.PermissionDenied, err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
target, err := apeTarget(req.GetBody().GetTarget())
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if err = s.localOverrideStorage.LocalStorage().RemoveOverridesByTarget(apechain.Ingress, target); err != nil {
|
||||||
|
if code := getCodeByLocalStorageErr(err); code != codes.NotFound {
|
||||||
|
return nil, status.Error(code, err.Error())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
resp := &control.RemoveChainLocalOverridesByTargetResponse{
|
||||||
|
Body: &control.RemoveChainLocalOverridesByTargetResponse_Body{},
|
||||||
|
}
|
||||||
|
err = SignMessage(s.key, resp)
|
||||||
|
if err != nil {
|
||||||
|
return nil, status.Error(codes.Internal, err.Error())
|
||||||
|
}
|
||||||
|
return resp, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (s *Server) ListTargetsLocalOverrides(_ context.Context, req *control.ListTargetsLocalOverridesRequest) (*control.ListTargetsLocalOverridesResponse, error) {
|
func (s *Server) ListTargetsLocalOverrides(_ context.Context, req *control.ListTargetsLocalOverridesRequest) (*control.ListTargetsLocalOverridesResponse, error) {
|
||||||
if err := s.isValidRequest(req); err != nil {
|
if err := s.isValidRequest(req); err != nil {
|
||||||
return nil, status.Error(codes.PermissionDenied, err.Error())
|
return nil, status.Error(codes.PermissionDenied, err.Error())
|
||||||
|
|
BIN
pkg/services/control/service.pb.go
generated
BIN
pkg/services/control/service.pb.go
generated
Binary file not shown.
|
@ -60,6 +60,9 @@ service ControlService {
|
||||||
// Remove local access policy engine overrides stored in the node by chaind id.
|
// Remove local access policy engine overrides stored in the node by chaind id.
|
||||||
rpc RemoveChainLocalOverride (RemoveChainLocalOverrideRequest) returns (RemoveChainLocalOverrideResponse);
|
rpc RemoveChainLocalOverride (RemoveChainLocalOverrideRequest) returns (RemoveChainLocalOverrideResponse);
|
||||||
|
|
||||||
|
// Remove local access policy engine overrides stored in the node by chaind id.
|
||||||
|
rpc RemoveChainLocalOverridesByTarget (RemoveChainLocalOverridesByTargetRequest) returns (RemoveChainLocalOverridesByTargetResponse);
|
||||||
|
|
||||||
// List targets of the local APE overrides stored in the node.
|
// List targets of the local APE overrides stored in the node.
|
||||||
rpc ListTargetsLocalOverrides (ListTargetsLocalOverridesRequest) returns (ListTargetsLocalOverridesResponse);
|
rpc ListTargetsLocalOverrides (ListTargetsLocalOverridesRequest) returns (ListTargetsLocalOverridesResponse);
|
||||||
|
|
||||||
|
@ -592,6 +595,26 @@ message RemoveChainLocalOverrideResponse {
|
||||||
Signature signature = 2;
|
Signature signature = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message RemoveChainLocalOverridesByTargetRequest {
|
||||||
|
message Body {
|
||||||
|
// Target for which the overrides are applied.
|
||||||
|
ChainTarget target = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
Body body = 1;
|
||||||
|
|
||||||
|
Signature signature = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message RemoveChainLocalOverridesByTargetResponse {
|
||||||
|
message Body {
|
||||||
|
}
|
||||||
|
|
||||||
|
Body body = 1;
|
||||||
|
|
||||||
|
Signature signature = 2;
|
||||||
|
}
|
||||||
|
|
||||||
message SealWriteCacheRequest {
|
message SealWriteCacheRequest {
|
||||||
// Request body structure.
|
// Request body structure.
|
||||||
message Body {
|
message Body {
|
||||||
|
|
BIN
pkg/services/control/service_frostfs.pb.go
generated
BIN
pkg/services/control/service_frostfs.pb.go
generated
Binary file not shown.
BIN
pkg/services/control/service_grpc.pb.go
generated
BIN
pkg/services/control/service_grpc.pb.go
generated
Binary file not shown.
Loading…
Reference in a new issue