Skip to content

Commit

Permalink
chore: remove BackupRestoreFinish
Browse files Browse the repository at this point in the history
longhorn/longhorn-6613

Signed-off-by: Chin-Ya Huang <chin-ya.huang@suse.com>
  • Loading branch information
c3y1huang authored and derekbit committed Aug 28, 2024
1 parent 494ed7c commit 1bdcacd
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 66 deletions.
30 changes: 0 additions & 30 deletions pkg/client/proxy_backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,36 +182,6 @@ func (c *ProxyClient) BackupRestore(dataEngine, engineName, volumeName, serviceA
return nil
}

func (c *ProxyClient) BackupRestoreFinish(dataEngine, engineName, volumeName, serviceAddress string) error {
input := map[string]string{
"engineName": engineName,
"volumeName": volumeName,
"serviceAddress": serviceAddress,
}
if err := validateProxyMethodParameters(input); err != nil {
return errors.Wrap(err, "failed to finishing backup restoration")
}

driver, ok := rpc.DataEngine_value[getDataEngine(dataEngine)]
if !ok {
return fmt.Errorf("failed to finishing backup restoration: invalid data engine %v", dataEngine)
}

req := &rpc.EngineBackupRestoreFinishRequest{
ProxyEngineRequest: &rpc.ProxyEngineRequest{
Address: serviceAddress,
EngineName: engineName,
// nolint:all replaced with DataEngine
BackendStoreDriver: rpc.BackendStoreDriver(driver),
DataEngine: rpc.DataEngine(driver),
// This is the name we will use for validation when communicating with the restoring engine.
VolumeName: volumeName,
},
}
_, err := c.service.BackupRestoreFinish(getContextWithGRPCTimeout(c.ctx), req)
return err
}

func (c *ProxyClient) BackupRestoreStatus(dataEngine, engineName, volumeName, serviceAddress string) (status map[string]*BackupRestoreStatus, err error) {
input := map[string]string{
"engineName": engineName,
Expand Down
35 changes: 0 additions & 35 deletions pkg/proxy/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,41 +309,6 @@ func (ops V2DataEngineProxyOps) BackupRestore(ctx context.Context, req *rpc.Engi
})
}

func (p *Proxy) BackupRestoreFinish(ctx context.Context, req *rpc.EngineBackupRestoreFinishRequest) (resp *emptypb.Empty, err error) {
log := logrus.WithFields(logrus.Fields{
"serviceURL": req.ProxyEngineRequest.Address,
"engineName": req.ProxyEngineRequest.EngineName,
"volumeName": req.ProxyEngineRequest.VolumeName,
"dataEngine": req.ProxyEngineRequest.DataEngine,
})
log.Info("Finishing backup restoration")

ops, ok := p.ops[req.ProxyEngineRequest.DataEngine]
if !ok {
return nil, grpcstatus.Errorf(grpccodes.Unimplemented, "unsupported data engine %v", req.ProxyEngineRequest.DataEngine)
}
return ops.BackupRestoreFinish(ctx, req)
}

func (ops V1DataEngineProxyOps) BackupRestoreFinish(ctx context.Context, req *rpc.EngineBackupRestoreFinishRequest) (*emptypb.Empty, error) {
// TODO: implement this
return nil, grpcstatus.Errorf(grpccodes.Unimplemented, "not implemented")
}

func (ops V2DataEngineProxyOps) BackupRestoreFinish(ctx context.Context, req *rpc.EngineBackupRestoreFinishRequest) (*emptypb.Empty, error) {
c, err := getSPDKClientFromAddress(req.ProxyEngineRequest.Address)
if err != nil {
return nil, grpcstatus.Errorf(grpccodes.Internal, errors.Wrapf(err, "failed to get SPDK client from engine address %v", req.ProxyEngineRequest.Address).Error())
}
defer c.Close()

err = c.EngineBackupRestoreFinish(req.ProxyEngineRequest.EngineName)
if err != nil {
return nil, grpcstatus.Errorf(grpccodes.Internal, errors.Wrapf(err, "failed to finish backup restoration").Error())
}
return &emptypb.Empty{}, nil
}

func (p *Proxy) BackupRestoreStatus(ctx context.Context, req *rpc.ProxyEngineRequest) (resp *rpc.EngineBackupRestoreStatusProxyResponse, err error) {
log := logrus.WithFields(logrus.Fields{
"serviceURL": req.Address,
Expand Down
1 change: 0 additions & 1 deletion pkg/proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ type ProxyOps interface {
SnapshotBackup(context.Context, *rpc.EngineSnapshotBackupRequest, map[string]string, []string) (*rpc.EngineSnapshotBackupProxyResponse, error)
SnapshotBackupStatus(context.Context, *rpc.EngineSnapshotBackupStatusRequest) (*rpc.EngineSnapshotBackupStatusProxyResponse, error)
BackupRestore(context.Context, *rpc.EngineBackupRestoreRequest, map[string]string) error
BackupRestoreFinish(context.Context, *rpc.EngineBackupRestoreFinishRequest) (*emptypb.Empty, error)
BackupRestoreStatus(context.Context, *rpc.ProxyEngineRequest) (*rpc.EngineBackupRestoreStatusProxyResponse, error)
}

Expand Down

0 comments on commit 1bdcacd

Please sign in to comment.