2021-03-15 11:04:13 +00:00
|
|
|
package control
|
|
|
|
|
|
|
|
import (
|
2023-03-07 13:38:26 +00:00
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/client"
|
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/common"
|
2021-03-15 11:04:13 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
const serviceName = "control.ControlService"
|
|
|
|
|
|
|
|
const (
|
2024-01-26 14:10:26 +00:00
|
|
|
rpcHealthCheck = "HealthCheck"
|
|
|
|
rpcSetNetmapStatus = "SetNetmapStatus"
|
|
|
|
rpcDropObjects = "DropObjects"
|
|
|
|
rpcListShards = "ListShards"
|
|
|
|
rpcSetShardMode = "SetShardMode"
|
|
|
|
rpcSynchronizeTree = "SynchronizeTree"
|
|
|
|
rpcEvacuateShard = "EvacuateShard"
|
|
|
|
rpcStartShardEvacuation = "StartShardEvacuation"
|
|
|
|
rpcGetShardEvacuationStatus = "GetShardEvacuationStatus"
|
|
|
|
rpcStopShardEvacuation = "StopShardEvacuation"
|
|
|
|
rpcFlushCache = "FlushCache"
|
|
|
|
rpcDoctor = "Doctor"
|
|
|
|
rpcAddChainLocalOverride = "AddChainLocalOverride"
|
|
|
|
rpcGetChainLocalOverride = "GetChainLocalOverride"
|
|
|
|
rpcListChainLocalOverrides = "ListChainLocalOverrides"
|
|
|
|
rpcRemoveChainLocalOverride = "RemoveChainLocalOverride"
|
|
|
|
rpcSealWriteCache = "SealWriteCache"
|
|
|
|
rpcListTargetsLocalOverrides = "ListTargetsLocalOverrides"
|
2024-01-30 15:18:58 +00:00
|
|
|
rpcDetachShards = "DetachShards"
|
2021-03-15 11:04:13 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// HealthCheck executes ControlService.HealthCheck RPC.
|
|
|
|
func HealthCheck(
|
|
|
|
cli *client.Client,
|
|
|
|
req *HealthCheckRequest,
|
|
|
|
opts ...client.CallOption,
|
|
|
|
) (*HealthCheckResponse, error) {
|
2023-04-27 10:38:25 +00:00
|
|
|
wResp := newResponseWrapper[HealthCheckResponse]()
|
2021-03-15 11:04:13 +00:00
|
|
|
wReq := &requestWrapper{
|
|
|
|
m: req,
|
|
|
|
}
|
|
|
|
|
|
|
|
err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceName, rpcHealthCheck), wReq, wResp, opts...)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
2023-04-27 10:38:25 +00:00
|
|
|
return wResp.message, nil
|
2021-03-15 11:04:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// SetNetmapStatus executes ControlService.SetNetmapStatus RPC.
|
|
|
|
func SetNetmapStatus(
|
|
|
|
cli *client.Client,
|
|
|
|
req *SetNetmapStatusRequest,
|
|
|
|
opts ...client.CallOption,
|
|
|
|
) (*SetNetmapStatusResponse, error) {
|
2023-04-27 10:38:25 +00:00
|
|
|
wResp := newResponseWrapper[SetNetmapStatusResponse]()
|
2021-03-15 11:04:13 +00:00
|
|
|
|
|
|
|
wReq := &requestWrapper{
|
|
|
|
m: req,
|
|
|
|
}
|
|
|
|
|
|
|
|
err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceName, rpcSetNetmapStatus), wReq, wResp, opts...)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
2023-04-27 10:38:25 +00:00
|
|
|
return wResp.message, nil
|
2021-03-15 11:04:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// DropObjects executes ControlService.DropObjects RPC.
|
|
|
|
func DropObjects(
|
|
|
|
cli *client.Client,
|
|
|
|
req *DropObjectsRequest,
|
|
|
|
opts ...client.CallOption,
|
|
|
|
) (*DropObjectsResponse, error) {
|
2023-04-27 10:38:25 +00:00
|
|
|
wResp := newResponseWrapper[DropObjectsResponse]()
|
2021-03-15 11:04:13 +00:00
|
|
|
|
|
|
|
wReq := &requestWrapper{
|
|
|
|
m: req,
|
|
|
|
}
|
|
|
|
err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceName, rpcDropObjects), wReq, wResp, opts...)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
2023-04-27 10:38:25 +00:00
|
|
|
return wResp.message, nil
|
2021-03-15 11:04:13 +00:00
|
|
|
}
|
2021-12-17 15:23:46 +00:00
|
|
|
|
|
|
|
// ListShards executes ControlService.ListShards RPC.
|
|
|
|
func ListShards(
|
|
|
|
cli *client.Client,
|
|
|
|
req *ListShardsRequest,
|
|
|
|
opts ...client.CallOption,
|
|
|
|
) (*ListShardsResponse, error) {
|
2023-04-27 10:38:25 +00:00
|
|
|
wResp := newResponseWrapper[ListShardsResponse]()
|
2021-12-17 15:23:46 +00:00
|
|
|
|
|
|
|
wReq := &requestWrapper{
|
|
|
|
m: req,
|
|
|
|
}
|
|
|
|
err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceName, rpcListShards), wReq, wResp, opts...)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
2023-04-27 10:38:25 +00:00
|
|
|
return wResp.message, nil
|
2021-12-17 15:23:46 +00:00
|
|
|
}
|
2021-12-27 16:12:23 +00:00
|
|
|
|
|
|
|
// SetShardMode executes ControlService.SetShardMode RPC.
|
|
|
|
func SetShardMode(
|
|
|
|
cli *client.Client,
|
|
|
|
req *SetShardModeRequest,
|
|
|
|
opts ...client.CallOption,
|
|
|
|
) (*SetShardModeResponse, error) {
|
2023-04-27 10:38:25 +00:00
|
|
|
wResp := newResponseWrapper[SetShardModeResponse]()
|
2021-12-27 16:12:23 +00:00
|
|
|
|
|
|
|
wReq := &requestWrapper{
|
|
|
|
m: req,
|
|
|
|
}
|
|
|
|
err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceName, rpcSetShardMode), wReq, wResp, opts...)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
2023-04-27 10:38:25 +00:00
|
|
|
return wResp.message, nil
|
2021-12-27 16:12:23 +00:00
|
|
|
}
|
2022-01-24 10:13:37 +00:00
|
|
|
|
2022-05-16 16:31:50 +00:00
|
|
|
// SynchronizeTree executes ControlService.SynchronizeTree RPC.
|
|
|
|
func SynchronizeTree(cli *client.Client, req *SynchronizeTreeRequest, opts ...client.CallOption) (*SynchronizeTreeResponse, error) {
|
2023-04-27 10:38:25 +00:00
|
|
|
wResp := newResponseWrapper[SynchronizeTreeResponse]()
|
2022-05-16 16:31:50 +00:00
|
|
|
wReq := &requestWrapper{m: req}
|
|
|
|
|
|
|
|
err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceName, rpcSynchronizeTree), wReq, wResp, opts...)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
2023-04-27 10:38:25 +00:00
|
|
|
return wResp.message, nil
|
2022-05-16 16:31:50 +00:00
|
|
|
}
|
2022-09-13 10:28:08 +00:00
|
|
|
|
|
|
|
// EvacuateShard executes ControlService.EvacuateShard RPC.
|
|
|
|
func EvacuateShard(cli *client.Client, req *EvacuateShardRequest, opts ...client.CallOption) (*EvacuateShardResponse, error) {
|
2023-04-27 10:38:25 +00:00
|
|
|
wResp := newResponseWrapper[EvacuateShardResponse]()
|
2022-09-13 10:28:08 +00:00
|
|
|
wReq := &requestWrapper{m: req}
|
|
|
|
|
|
|
|
err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceName, rpcEvacuateShard), wReq, wResp, opts...)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
2023-04-27 10:38:25 +00:00
|
|
|
return wResp.message, nil
|
2022-09-13 10:28:08 +00:00
|
|
|
}
|
2022-09-21 10:51:51 +00:00
|
|
|
|
2023-05-26 08:26:54 +00:00
|
|
|
// StartShardEvacuation executes ControlService.StartShardEvacuation RPC.
|
|
|
|
func StartShardEvacuation(cli *client.Client, req *StartShardEvacuationRequest, opts ...client.CallOption) (*StartShardEvacuationResponse, error) {
|
2023-05-05 07:57:07 +00:00
|
|
|
wResp := newResponseWrapper[StartShardEvacuationResponse]()
|
|
|
|
wReq := &requestWrapper{m: req}
|
|
|
|
|
2023-05-26 08:26:54 +00:00
|
|
|
err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceName, rpcStartShardEvacuation), wReq, wResp, opts...)
|
2023-05-05 07:57:07 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
return wResp.message, nil
|
|
|
|
}
|
|
|
|
|
2023-05-26 08:26:54 +00:00
|
|
|
// GetShardEvacuationStatus executes ControlService.GetShardEvacuationStatus RPC.
|
|
|
|
func GetShardEvacuationStatus(cli *client.Client, req *GetShardEvacuationStatusRequest, opts ...client.CallOption) (*GetShardEvacuationStatusResponse, error) {
|
2023-05-05 07:57:07 +00:00
|
|
|
wResp := newResponseWrapper[GetShardEvacuationStatusResponse]()
|
|
|
|
wReq := &requestWrapper{m: req}
|
|
|
|
|
2023-05-26 08:26:54 +00:00
|
|
|
err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceName, rpcGetShardEvacuationStatus), wReq, wResp, opts...)
|
2023-05-05 07:57:07 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
return wResp.message, nil
|
|
|
|
}
|
|
|
|
|
2023-05-26 08:26:54 +00:00
|
|
|
// StopShardEvacuation executes ControlService.StopShardEvacuation RPC.
|
|
|
|
func StopShardEvacuation(cli *client.Client, req *StopShardEvacuationRequest, opts ...client.CallOption) (*StopShardEvacuationResponse, error) {
|
2023-05-05 07:57:07 +00:00
|
|
|
wResp := newResponseWrapper[StopShardEvacuationResponse]()
|
|
|
|
wReq := &requestWrapper{m: req}
|
|
|
|
|
2023-05-26 08:26:54 +00:00
|
|
|
err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceName, rpcStopShardEvacuation), wReq, wResp, opts...)
|
2023-05-05 07:57:07 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
return wResp.message, nil
|
|
|
|
}
|
|
|
|
|
2022-09-21 10:51:51 +00:00
|
|
|
// FlushCache executes ControlService.FlushCache RPC.
|
|
|
|
func FlushCache(cli *client.Client, req *FlushCacheRequest, opts ...client.CallOption) (*FlushCacheResponse, error) {
|
2023-04-27 10:38:25 +00:00
|
|
|
wResp := newResponseWrapper[FlushCacheResponse]()
|
2022-09-21 10:51:51 +00:00
|
|
|
wReq := &requestWrapper{m: req}
|
|
|
|
|
|
|
|
err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceName, rpcFlushCache), wReq, wResp, opts...)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
2023-04-27 10:38:25 +00:00
|
|
|
return wResp.message, nil
|
2022-09-21 10:51:51 +00:00
|
|
|
}
|
2023-04-07 11:21:05 +00:00
|
|
|
|
|
|
|
// Doctor executes ControlService.Doctor RPC.
|
|
|
|
func Doctor(cli *client.Client, req *DoctorRequest, opts ...client.CallOption) (*DoctorResponse, error) {
|
2023-04-27 10:38:25 +00:00
|
|
|
wResp := newResponseWrapper[DoctorResponse]()
|
2023-04-07 11:21:05 +00:00
|
|
|
wReq := &requestWrapper{m: req}
|
|
|
|
|
|
|
|
err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceName, rpcDoctor), wReq, wResp, opts...)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
2023-04-27 10:38:25 +00:00
|
|
|
return wResp.message, nil
|
2023-04-07 11:21:05 +00:00
|
|
|
}
|
2023-10-31 08:55:42 +00:00
|
|
|
|
|
|
|
// AddChainLocalOverride executes ControlService.AddChainLocalOverride RPC.
|
|
|
|
func AddChainLocalOverride(cli *client.Client, req *AddChainLocalOverrideRequest, opts ...client.CallOption) (*AddChainLocalOverrideResponse, error) {
|
|
|
|
wResp := newResponseWrapper[AddChainLocalOverrideResponse]()
|
|
|
|
wReq := &requestWrapper{m: req}
|
|
|
|
|
|
|
|
err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceName, rpcAddChainLocalOverride), wReq, wResp, opts...)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
return wResp.message, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// ListChainLocalOverrides executes ControlService.ListChainLocalOverrides RPC.
|
|
|
|
func ListChainLocalOverrides(cli *client.Client, req *ListChainLocalOverridesRequest, opts ...client.CallOption) (*ListChainLocalOverridesResponse, error) {
|
|
|
|
wResp := newResponseWrapper[ListChainLocalOverridesResponse]()
|
|
|
|
wReq := &requestWrapper{m: req}
|
|
|
|
|
|
|
|
err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceName, rpcListChainLocalOverrides), wReq, wResp, opts...)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
return wResp.message, nil
|
|
|
|
}
|
|
|
|
|
2024-01-26 14:10:26 +00:00
|
|
|
// ListTargetsLocalOverrides executes ControlService.ListTargetsLocalOverrides RPC.
|
|
|
|
func ListTargetsLocalOverrides(cli *client.Client, req *ListTargetsLocalOverridesRequest, opts ...client.CallOption) (*ListTargetsLocalOverridesResponse, error) {
|
|
|
|
wResp := newResponseWrapper[ListTargetsLocalOverridesResponse]()
|
|
|
|
wReq := &requestWrapper{m: req}
|
|
|
|
|
|
|
|
err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceName, rpcListTargetsLocalOverrides), wReq, wResp, opts...)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
return wResp.message, nil
|
|
|
|
}
|
|
|
|
|
2023-10-31 08:55:42 +00:00
|
|
|
// RemoveChainLocalOverride executes ControlService.RemoveChainLocalOverride RPC.
|
|
|
|
func GetChainLocalOverride(cli *client.Client, req *GetChainLocalOverrideRequest, opts ...client.CallOption) (*GetChainLocalOverrideResponse, error) {
|
|
|
|
wResp := newResponseWrapper[GetChainLocalOverrideResponse]()
|
|
|
|
wReq := &requestWrapper{m: req}
|
|
|
|
|
|
|
|
err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceName, rpcGetChainLocalOverride), wReq, wResp, opts...)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
return wResp.message, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// RemoveChainLocalOverride executes ControlService.RemoveChainLocalOverride RPC.
|
|
|
|
func RemoveChainLocalOverride(cli *client.Client, req *RemoveChainLocalOverrideRequest, opts ...client.CallOption) (*RemoveChainLocalOverrideResponse, error) {
|
|
|
|
wResp := newResponseWrapper[RemoveChainLocalOverrideResponse]()
|
|
|
|
wReq := &requestWrapper{m: req}
|
|
|
|
|
|
|
|
err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceName, rpcRemoveChainLocalOverride), wReq, wResp, opts...)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
return wResp.message, nil
|
|
|
|
}
|
2023-12-27 11:37:22 +00:00
|
|
|
|
|
|
|
// SealWriteCache executes ControlService.SealWriteCache RPC.
|
|
|
|
func SealWriteCache(cli *client.Client, req *SealWriteCacheRequest, opts ...client.CallOption) (*SealWriteCacheResponse, error) {
|
|
|
|
wResp := newResponseWrapper[SealWriteCacheResponse]()
|
|
|
|
wReq := &requestWrapper{m: req}
|
|
|
|
|
|
|
|
err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceName, rpcSealWriteCache), wReq, wResp, opts...)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
return wResp.message, nil
|
|
|
|
}
|
2024-01-30 15:18:58 +00:00
|
|
|
|
|
|
|
// DetachShards executes ControlService.DetachShards RPC.
|
|
|
|
func DetachShards(
|
|
|
|
cli *client.Client,
|
|
|
|
req *DetachShardsRequest,
|
|
|
|
opts ...client.CallOption,
|
|
|
|
) (*DetachShardsResponse, error) {
|
|
|
|
wResp := newResponseWrapper[DetachShardsResponse]()
|
|
|
|
|
|
|
|
wReq := &requestWrapper{
|
|
|
|
m: req,
|
|
|
|
}
|
|
|
|
err := client.SendUnary(cli, common.CallMethodInfoUnary(serviceName, rpcDetachShards), wReq, wResp, opts...)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
return wResp.message, nil
|
|
|
|
}
|