package control import ( "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/client" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/common" ) const serviceName = "control.ControlService" const ( rpcHealthCheck = "HealthCheck" rpcSetNetmapStatus = "SetNetmapStatus" rpcDropObjects = "DropObjects" rpcListShards = "ListShards" rpcSetShardMode = "SetShardMode" rpcSynchronizeTree = "SynchronizeTree" rpcEvacuateShard = "EvacuateShard" rpcStartEvacuateShard = "StartEvacuateShard" rpcGetEvacuateShardStatus = "GetEvacuateShardStatus" rpcStopEvacuateShardStatus = "StopEvacuateShard" rpcFlushCache = "FlushCache" rpcDoctor = "Doctor" ) // HealthCheck executes ControlService.HealthCheck RPC. func HealthCheck( cli *client.Client, req *HealthCheckRequest, opts ...client.CallOption, ) (*HealthCheckResponse, error) { wResp := newResponseWrapper[HealthCheckResponse]() wReq := &requestWrapper{ m: req, } err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceName, rpcHealthCheck), wReq, wResp, opts...) if err != nil { return nil, err } return wResp.message, nil } // SetNetmapStatus executes ControlService.SetNetmapStatus RPC. func SetNetmapStatus( cli *client.Client, req *SetNetmapStatusRequest, opts ...client.CallOption, ) (*SetNetmapStatusResponse, error) { wResp := newResponseWrapper[SetNetmapStatusResponse]() wReq := &requestWrapper{ m: req, } err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceName, rpcSetNetmapStatus), wReq, wResp, opts...) if err != nil { return nil, err } return wResp.message, nil } // DropObjects executes ControlService.DropObjects RPC. func DropObjects( cli *client.Client, req *DropObjectsRequest, opts ...client.CallOption, ) (*DropObjectsResponse, error) { wResp := newResponseWrapper[DropObjectsResponse]() wReq := &requestWrapper{ m: req, } err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceName, rpcDropObjects), wReq, wResp, opts...) if err != nil { return nil, err } return wResp.message, nil } // ListShards executes ControlService.ListShards RPC. func ListShards( cli *client.Client, req *ListShardsRequest, opts ...client.CallOption, ) (*ListShardsResponse, error) { wResp := newResponseWrapper[ListShardsResponse]() wReq := &requestWrapper{ m: req, } err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceName, rpcListShards), wReq, wResp, opts...) if err != nil { return nil, err } return wResp.message, nil } // SetShardMode executes ControlService.SetShardMode RPC. func SetShardMode( cli *client.Client, req *SetShardModeRequest, opts ...client.CallOption, ) (*SetShardModeResponse, error) { wResp := newResponseWrapper[SetShardModeResponse]() wReq := &requestWrapper{ m: req, } err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceName, rpcSetShardMode), wReq, wResp, opts...) if err != nil { return nil, err } return wResp.message, nil } // SynchronizeTree executes ControlService.SynchronizeTree RPC. func SynchronizeTree(cli *client.Client, req *SynchronizeTreeRequest, opts ...client.CallOption) (*SynchronizeTreeResponse, error) { wResp := newResponseWrapper[SynchronizeTreeResponse]() wReq := &requestWrapper{m: req} err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceName, rpcSynchronizeTree), wReq, wResp, opts...) if err != nil { return nil, err } return wResp.message, nil } // EvacuateShard executes ControlService.EvacuateShard RPC. func EvacuateShard(cli *client.Client, req *EvacuateShardRequest, opts ...client.CallOption) (*EvacuateShardResponse, error) { wResp := newResponseWrapper[EvacuateShardResponse]() wReq := &requestWrapper{m: req} err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceName, rpcEvacuateShard), wReq, wResp, opts...) if err != nil { return nil, err } return wResp.message, nil } // StartEvacuateShard executes ControlService.StartEvacuateShard RPC. func StartEvacuateShard(cli *client.Client, req *StartShardEvacuationRequest, opts ...client.CallOption) (*StartShardEvacuationResponse, error) { wResp := newResponseWrapper[StartShardEvacuationResponse]() wReq := &requestWrapper{m: req} err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceName, rpcStartEvacuateShard), wReq, wResp, opts...) if err != nil { return nil, err } return wResp.message, nil } // GetEvacuateShardStatus executes ControlService.GetEvacuateShardStatus RPC. func GetEvacuateShardStatus(cli *client.Client, req *GetShardEvacuationStatusRequest, opts ...client.CallOption) (*GetShardEvacuationStatusResponse, error) { wResp := newResponseWrapper[GetShardEvacuationStatusResponse]() wReq := &requestWrapper{m: req} err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceName, rpcGetEvacuateShardStatus), wReq, wResp, opts...) if err != nil { return nil, err } return wResp.message, nil } // StopEvacuateShard executes ControlService.StopEvacuateShard RPC. func StopEvacuateShard(cli *client.Client, req *StopShardEvacuationRequest, opts ...client.CallOption) (*StopShardEvacuationResponse, error) { wResp := newResponseWrapper[StopShardEvacuationResponse]() wReq := &requestWrapper{m: req} err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceName, rpcStopEvacuateShardStatus), wReq, wResp, opts...) if err != nil { return nil, err } return wResp.message, nil } // FlushCache executes ControlService.FlushCache RPC. func FlushCache(cli *client.Client, req *FlushCacheRequest, opts ...client.CallOption) (*FlushCacheResponse, error) { wResp := newResponseWrapper[FlushCacheResponse]() wReq := &requestWrapper{m: req} err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceName, rpcFlushCache), wReq, wResp, opts...) if err != nil { return nil, err } return wResp.message, nil } // Doctor executes ControlService.Doctor RPC. func Doctor(cli *client.Client, req *DoctorRequest, opts ...client.CallOption) (*DoctorResponse, error) { wResp := newResponseWrapper[DoctorResponse]() wReq := &requestWrapper{m: req} err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceName, rpcDoctor), wReq, wResp, opts...) if err != nil { return nil, err } return wResp.message, nil }