chore: remove unused call & redundant ping methods

- Ping methods defined by engine.NewService for all services
- Call methods were previously replaced by the centralized call method
(on *birpc.Service) for all components
- All services now register V1/V2 objects from apier package for
consistency
This commit is contained in:
ionutboangiu
2024-09-05 20:39:57 +03:00
committed by Dan Christian Bogos
parent 67a8dd65f9
commit 6e971e954c
79 changed files with 192 additions and 1200 deletions

View File

@@ -21,15 +21,12 @@ package servmanager
import (
"errors"
"fmt"
"reflect"
"strings"
"sync"
"github.com/cgrates/birpc/context"
"github.com/cgrates/cgrates/config"
"github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
"github.com/cgrates/rpcclient"
)
// NewServiceManager returns a service manager
@@ -55,33 +52,6 @@ type ServiceManager struct {
connMgr *engine.ConnManager
}
// Call .
func (srvMngr *ServiceManager) Call(ctx *context.Context, serviceMethod string, args any, reply any) error {
parts := strings.Split(serviceMethod, ".")
if len(parts) != 2 {
return rpcclient.ErrUnsupporteServiceMethod
}
// get method
method := reflect.ValueOf(srvMngr).MethodByName(parts[0][len(parts[0])-2:] + parts[1]) // Inherit the version in the method
if !method.IsValid() {
return rpcclient.ErrUnsupporteServiceMethod
}
// construct the params
params := []reflect.Value{reflect.ValueOf(args), reflect.ValueOf(reply)}
ret := method.Call(params)
if len(ret) != 1 {
return utils.ErrServerError
}
if ret[0].Interface() == nil {
return nil
}
err, ok := ret[0].Interface().(error)
if !ok {
return utils.ErrServerError
}
return err
}
// ArgStartService are passed to Start/StopService/Status RPC methods
type ArgStartService struct {
ServiceID string