Removed GetInternalChan method from Service interface

This commit is contained in:
Trial97
2020-05-15 15:27:16 +03:00
committed by Dan Christian Bogos
parent f10f570a27
commit 9f8790a3d4
31 changed files with 23 additions and 183 deletions

View File

@@ -540,36 +540,36 @@ func main() {
// init internalRPCSet to share internal connections among the engine
engine.IntRPC = engine.NewRPCClientSet()
engine.IntRPC.AddInternalRPCClient(utils.AnalyzerSv1, anz.GetIntenternalChan())
engine.IntRPC.AddInternalRPCClient(utils.APIerSv1, apiSv1.GetIntenternalChan())
engine.IntRPC.AddInternalRPCClient(utils.APIerSv2, apiSv1.GetIntenternalChan())
engine.IntRPC.AddInternalRPCClient(utils.AttributeSv1, attrS.GetIntenternalChan())
engine.IntRPC.AddInternalRPCClient(utils.AnalyzerSv1, internalAnalyzerSChan)
engine.IntRPC.AddInternalRPCClient(utils.APIerSv1, internalAPIerSv1Chan)
engine.IntRPC.AddInternalRPCClient(utils.APIerSv2, internalAPIerSv2Chan)
engine.IntRPC.AddInternalRPCClient(utils.AttributeSv1, internalAttributeSChan)
engine.IntRPC.AddInternalRPCClient(utils.CacheSv1, internalCacheSChan)
engine.IntRPC.AddInternalRPCClient(utils.CDRsV1, cdrS.GetIntenternalChan())
engine.IntRPC.AddInternalRPCClient(utils.CDRsV2, cdrS.GetIntenternalChan())
engine.IntRPC.AddInternalRPCClient(utils.ChargerSv1, chrS.GetIntenternalChan())
engine.IntRPC.AddInternalRPCClient(utils.CDRsV1, internalCDRServerChan)
engine.IntRPC.AddInternalRPCClient(utils.CDRsV2, internalCDRServerChan)
engine.IntRPC.AddInternalRPCClient(utils.ChargerSv1, internalChargerSChan)
engine.IntRPC.AddInternalRPCClient(utils.GuardianSv1, internalGuardianSChan)
engine.IntRPC.AddInternalRPCClient(utils.LoaderSv1, ldrs.GetIntenternalChan())
engine.IntRPC.AddInternalRPCClient(utils.ResourceSv1, reS.GetIntenternalChan())
engine.IntRPC.AddInternalRPCClient(utils.Responder, rals.GetResponder().GetIntenternalChan())
engine.IntRPC.AddInternalRPCClient(utils.SchedulerSv1, schS.GetIntenternalChan())
engine.IntRPC.AddInternalRPCClient(utils.SessionSv1, smg.GetIntenternalChan())
engine.IntRPC.AddInternalRPCClient(utils.StatSv1, stS.GetIntenternalChan())
engine.IntRPC.AddInternalRPCClient(utils.RouteSv1, routeS.GetIntenternalChan())
engine.IntRPC.AddInternalRPCClient(utils.ThresholdSv1, tS.GetIntenternalChan())
engine.IntRPC.AddInternalRPCClient(utils.LoaderSv1, internalLoaderSChan)
engine.IntRPC.AddInternalRPCClient(utils.ResourceSv1, internalResourceSChan)
engine.IntRPC.AddInternalRPCClient(utils.Responder, internalResponderChan)
engine.IntRPC.AddInternalRPCClient(utils.SchedulerSv1, internalSchedulerSChan)
engine.IntRPC.AddInternalRPCClient(utils.SessionSv1, internalSessionSChan)
engine.IntRPC.AddInternalRPCClient(utils.StatSv1, internalStatSChan)
engine.IntRPC.AddInternalRPCClient(utils.RouteSv1, internalRouteSChan)
engine.IntRPC.AddInternalRPCClient(utils.ThresholdSv1, internalThresholdSChan)
engine.IntRPC.AddInternalRPCClient(utils.ServiceManagerV1, internalServeManagerChan)
engine.IntRPC.AddInternalRPCClient(utils.ConfigSv1, internalConfigChan)
engine.IntRPC.AddInternalRPCClient(utils.CoreSv1, internalCoreSv1Chan)
engine.IntRPC.AddInternalRPCClient(utils.RALsV1, rals.GetIntenternalChan())
engine.IntRPC.AddInternalRPCClient(utils.RALsV1, internalRALsChan)
initConfigSv1(internalConfigChan, server)
// Serve rpc connections
go startRpc(server, rals.GetResponder().GetIntenternalChan(), cdrS.GetIntenternalChan(),
reS.GetIntenternalChan(), stS.GetIntenternalChan(),
attrS.GetIntenternalChan(), chrS.GetIntenternalChan(), tS.GetIntenternalChan(),
routeS.GetIntenternalChan(), smg.GetIntenternalChan(), anz.GetIntenternalChan(),
dspS.GetIntenternalChan(), ldrs.GetIntenternalChan(), rals.GetIntenternalChan(),
go startRpc(server, internalResponderChan, internalCDRServerChan,
internalResourceSChan, internalStatSChan,
internalAttributeSChan, internalChargerSChan, internalThresholdSChan,
internalRouteSChan, internalSessionSChan, internalAnalyzerSChan,
internalDispatcherSChan, internalLoaderSChan, internalRALsChan,
internalCacheSChan, internalEEsChan, internalRateSChan, exitChan)
<-exitChan

View File

@@ -80,11 +80,6 @@ func (anz *AnalyzerService) Start() (err error) {
return
}
// GetIntenternalChan returns the internal connection chanel
func (anz *AnalyzerService) GetIntenternalChan() (conn chan rpcclient.ClientConnector) {
return anz.connChan
}
// Reload handles the change of config
func (anz *AnalyzerService) Reload() (err error) {
return // for the momment nothing to reload

View File

@@ -131,11 +131,6 @@ func (apiService *APIerSv1Service) Start() (err error) {
return
}
// GetIntenternalChan returns the internal connection chanel
func (apiService *APIerSv1Service) GetIntenternalChan() (conn chan rpcclient.ClientConnector) {
return apiService.connChan
}
// Reload handles the change of config
func (apiService *APIerSv1Service) Reload() (err error) {
return

View File

@@ -82,11 +82,6 @@ func (api *APIerSv2Service) Start() (err error) {
return
}
// GetIntenternalChan returns the internal connection chanel
func (api *APIerSv2Service) GetIntenternalChan() (conn chan rpcclient.ClientConnector) {
return api.connChan
}
// Reload handles the change of config
func (api *APIerSv2Service) Reload() (err error) {
return

View File

@@ -28,7 +28,6 @@ import (
"github.com/cgrates/cgrates/config"
"github.com/cgrates/cgrates/servmanager"
"github.com/cgrates/cgrates/utils"
"github.com/cgrates/rpcclient"
)
// NewAsteriskAgent returns the Asterisk Agent
@@ -77,11 +76,6 @@ func (ast *AsteriskAgent) Start() (err error) {
return
}
// GetIntenternalChan returns the internal connection chanel
func (ast *AsteriskAgent) GetIntenternalChan() (conn chan rpcclient.ClientConnector) {
return nil
}
// Reload handles the change of config
func (ast *AsteriskAgent) Reload() (err error) {
return

View File

@@ -91,11 +91,6 @@ func (attrS *AttributeService) Start() (err error) {
return
}
// GetIntenternalChan returns the internal connection chanel
func (attrS *AttributeService) GetIntenternalChan() (conn chan rpcclient.ClientConnector) {
return attrS.connChan
}
// Reload handles the change of config
func (attrS *AttributeService) Reload() (err error) {
return // for the momment nothing to reload

View File

@@ -111,11 +111,6 @@ func (cdrService *CDRServer) Start() (err error) {
return
}
// GetIntenternalChan returns the internal connection chanel
func (cdrService *CDRServer) GetIntenternalChan() (conn chan rpcclient.ClientConnector) {
return cdrService.connChan
}
// Reload handles the change of config
func (cdrService *CDRServer) Reload() (err error) {
return

View File

@@ -92,11 +92,6 @@ func (chrS *ChargerService) Start() (err error) {
return
}
// GetIntenternalChan returns the internal connection chanel
func (chrS *ChargerService) GetIntenternalChan() (conn chan rpcclient.ClientConnector) {
return chrS.connChan
}
// Reload handles the change of config
func (chrS *ChargerService) Reload() (err error) {
return

View File

@@ -25,7 +25,6 @@ import (
"github.com/cgrates/cgrates/config"
"github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
"github.com/cgrates/rpcclient"
)
// NewDataDBService returns the DataDB Service
@@ -80,11 +79,6 @@ func (db *DataDBService) Start() (err error) {
return
}
// GetIntenternalChan returns the internal connection chanel
func (db *DataDBService) GetIntenternalChan() (conn chan rpcclient.ClientConnector) {
return nil
}
// Reload handles the change of config
func (db *DataDBService) Reload() (err error) {
db.Lock()

View File

@@ -27,7 +27,6 @@ import (
"github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/servmanager"
"github.com/cgrates/cgrates/utils"
"github.com/cgrates/rpcclient"
)
// NewDiameterAgent returns the Diameter Agent
@@ -81,11 +80,6 @@ func (da *DiameterAgent) Start() (err error) {
return
}
// GetIntenternalChan returns the internal connection chanel
func (da *DiameterAgent) GetIntenternalChan() (conn chan rpcclient.ClientConnector) {
return nil
}
// Reload handles the change of config
func (da *DiameterAgent) Reload() (err error) {
return

View File

@@ -148,11 +148,6 @@ func (dspS *DispatcherService) Start() (err error) {
return
}
// GetIntenternalChan returns the internal connection chanel
func (dspS *DispatcherService) GetIntenternalChan() (conn chan rpcclient.ClientConnector) {
return dspS.connChan
}
// Reload handles the change of config
func (dspS *DispatcherService) Reload() (err error) {
return // for the momment nothing to reload

View File

@@ -27,7 +27,6 @@ import (
"github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/servmanager"
"github.com/cgrates/cgrates/utils"
"github.com/cgrates/rpcclient"
)
// NewDNSAgent returns the DNS Agent
@@ -80,12 +79,6 @@ func (dns *DNSAgent) Start() (err error) {
return
}
// GetIntenternalChan returns the internal connection chanel
// no chanel for DNSAgent
func (dns *DNSAgent) GetIntenternalChan() (conn chan rpcclient.ClientConnector) {
return nil
}
// Reload handles the change of config
func (dns *DNSAgent) Reload() (err error) {
if dns.oldListen == dns.cfg.DNSAgentCfg().Listen {

View File

@@ -22,7 +22,7 @@ import (
"fmt"
"sync"
"github.com/cgrates/cgrates/apier/v1"
v1 "github.com/cgrates/cgrates/apier/v1"
"github.com/cgrates/cgrates/config"
"github.com/cgrates/cgrates/ees"
"github.com/cgrates/cgrates/engine"
@@ -62,11 +62,6 @@ type EventExporterService struct {
rpc *v1.EventExporterSv1
}
// GetIntenternalChan is deprecated and it will be removed shortly
func (es *EventExporterService) GetIntenternalChan() (conn chan rpcclient.ClientConnector) {
panic("deprecated method")
}
// ServiceName returns the service name
func (es *EventExporterService) ServiceName() string {
return utils.EventExporterS

View File

@@ -27,7 +27,6 @@ import (
"github.com/cgrates/cgrates/ers"
"github.com/cgrates/cgrates/servmanager"
"github.com/cgrates/cgrates/utils"
"github.com/cgrates/rpcclient"
)
// NewEventReaderService returns the EventReader Service
@@ -83,11 +82,6 @@ func (erS *EventReaderService) Start() (err error) {
return
}
// GetIntenternalChan returns the internal connection chanel
func (erS *EventReaderService) GetIntenternalChan() (conn chan rpcclient.ClientConnector) {
return nil
}
// Reload handles the change of config
func (erS *EventReaderService) Reload() (err error) {
erS.RLock()

View File

@@ -28,7 +28,6 @@ import (
"github.com/cgrates/cgrates/config"
"github.com/cgrates/cgrates/servmanager"
"github.com/cgrates/cgrates/utils"
"github.com/cgrates/rpcclient"
)
// NewFreeswitchAgent returns the Freeswitch Agent
@@ -71,12 +70,6 @@ func (fS *FreeswitchAgent) Start() (err error) {
return
}
// GetIntenternalChan returns the internal connection chanel
// no chanel for FreeswitchAgent
func (fS *FreeswitchAgent) GetIntenternalChan() (conn chan rpcclient.ClientConnector) {
return nil
}
// Reload handles the change of config
func (fS *FreeswitchAgent) Reload() (err error) {
if err = fS.Shutdown(); err != nil {

View File

@@ -27,7 +27,6 @@ import (
"github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/servmanager"
"github.com/cgrates/cgrates/utils"
"github.com/cgrates/rpcclient"
)
// NewHTTPAgent returns the HTTP Agent
@@ -73,11 +72,6 @@ func (ha *HTTPAgent) Start() (err error) {
return
}
// GetIntenternalChan returns the internal connection chanel
func (ha *HTTPAgent) GetIntenternalChan() (conn chan rpcclient.ClientConnector) {
return nil
}
// Reload handles the change of config
func (ha *HTTPAgent) Reload() (err error) {
return // no reload

View File

@@ -29,7 +29,6 @@ import (
"github.com/cgrates/cgrates/config"
"github.com/cgrates/cgrates/servmanager"
"github.com/cgrates/cgrates/utils"
"github.com/cgrates/rpcclient"
)
// NewKamailioAgent returns the Kamailio Agent
@@ -76,11 +75,6 @@ func (kam *KamailioAgent) Start() (err error) {
return
}
// GetIntenternalChan returns the internal connection chanel
func (kam *KamailioAgent) GetIntenternalChan() (conn chan rpcclient.ClientConnector) {
return nil
}
// Reload handles the change of config
func (kam *KamailioAgent) Reload() (err error) {

View File

@@ -90,11 +90,6 @@ func (ldrs *LoaderService) Start() (err error) {
return
}
// GetIntenternalChan returns the internal connection chanel
func (ldrs *LoaderService) GetIntenternalChan() (conn chan rpcclient.ClientConnector) {
return ldrs.connChan
}
// Reload handles the change of config
func (ldrs *LoaderService) Reload() (err error) {
filterS := <-ldrs.filterSChan

View File

@@ -27,7 +27,6 @@ import (
"github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/servmanager"
"github.com/cgrates/cgrates/utils"
"github.com/cgrates/rpcclient"
)
// NewRadiusAgent returns the Radius Agent
@@ -78,11 +77,6 @@ func (rad *RadiusAgent) Start() (err error) {
return
}
// GetIntenternalChan returns the internal connection chanel
func (rad *RadiusAgent) GetIntenternalChan() (conn chan rpcclient.ClientConnector) {
return nil
}
// Reload handles the change of config
func (rad *RadiusAgent) Reload() (err error) {
return

View File

@@ -95,11 +95,6 @@ func (rals *RalService) Start() (err error) {
return
}
// GetIntenternalChan returns the internal connection chanel
func (rals *RalService) GetIntenternalChan() (conn chan rpcclient.ClientConnector) {
return rals.connChan
}
// Reload handles the change of config
func (rals *RalService) Reload() (err error) {
engine.SetRpSubjectPrefixMatching(rals.cfg.RalsCfg().RpSubjectPrefixMatching)

View File

@@ -27,6 +27,7 @@ import (
"github.com/cgrates/cgrates/rates"
"github.com/cgrates/cgrates/servmanager"
"github.com/cgrates/cgrates/utils"
//"github.com/cgrates/cgrates/apier/v1"
"github.com/cgrates/rpcclient"
)
@@ -60,11 +61,6 @@ type RateService struct {
//rpc *v1.EventExporterSv1
}
// GetIntenternalChan is deprecated and it will be removed shortly
func (rs *RateService) GetIntenternalChan() (conn chan rpcclient.ClientConnector) {
panic("deprecated method")
}
// ServiceName returns the service name
func (rs *RateService) ServiceName() string {
return utils.RateS

View File

@@ -94,11 +94,6 @@ func (reS *ResourceService) Start() (err error) {
return
}
// GetIntenternalChan returns the internal connection chanel
func (reS *ResourceService) GetIntenternalChan() (conn chan rpcclient.ClientConnector) {
return reS.connChan
}
// Reload handles the change of config
func (reS *ResourceService) Reload() (err error) {
reS.Lock()

View File

@@ -75,11 +75,6 @@ func (resp *ResponderService) Start() (err error) {
return
}
// GetIntenternalChan returns the internal connection chanel
func (resp *ResponderService) GetIntenternalChan() (conn chan rpcclient.ClientConnector) {
return resp.connChan
}
// Reload handles the change of config
func (resp *ResponderService) Reload() (err error) {
resp.Lock()

View File

@@ -95,11 +95,6 @@ func (routeS *RouteService) Start() (err error) {
return
}
// GetIntenternalChan returns the internal connection chanel
func (routeS *RouteService) GetIntenternalChan() (conn chan rpcclient.ClientConnector) {
return routeS.connChan
}
// Reload handles the change of config
func (routeS *RouteService) Reload() (err error) {
return

View File

@@ -90,11 +90,6 @@ func (schS *SchedulerService) Start() (err error) {
return
}
// GetIntenternalChan returns the internal connection chanel
func (schS *SchedulerService) GetIntenternalChan() (conn chan rpcclient.ClientConnector) {
return schS.connChan
}
// Reload handles the change of config
func (schS *SchedulerService) Reload() (err error) {
schS.Lock()

View File

@@ -117,11 +117,6 @@ func (smg *SessionService) Start() (err error) {
return
}
// GetIntenternalChan returns the internal connection chanel
func (smg *SessionService) GetIntenternalChan() (conn chan rpcclient.ClientConnector) {
return smg.connChan
}
// Reload handles the change of config
func (smg *SessionService) Reload() (err error) {
return

View File

@@ -27,7 +27,6 @@ import (
"github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/servmanager"
"github.com/cgrates/cgrates/utils"
"github.com/cgrates/rpcclient"
)
// NewSIPAgent returns the sip Agent
@@ -76,12 +75,6 @@ func (sip *SIPAgent) Start() (err error) {
return
}
// GetIntenternalChan returns the internal connection chanel
// no chanel for SIPAgent
func (sip *SIPAgent) GetIntenternalChan() (conn chan rpcclient.ClientConnector) {
return nil
}
// Reload handles the change of config
func (sip *SIPAgent) Reload() (err error) {
if sip.oldListen == sip.cfg.SIPAgentCfg().Listen {

View File

@@ -96,11 +96,6 @@ func (sts *StatService) Start() (err error) {
return
}
// GetIntenternalChan returns the internal connection chanel
func (sts *StatService) GetIntenternalChan() (conn chan rpcclient.ClientConnector) {
return sts.connChan
}
// Reload handles the change of config
func (sts *StatService) Reload() (err error) {
sts.Lock()

View File

@@ -26,7 +26,6 @@ import (
"github.com/cgrates/cgrates/config"
"github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
"github.com/cgrates/rpcclient"
)
// NewStorDBService returns the StorDB Service
@@ -78,11 +77,6 @@ func (db *StorDBService) Start() (err error) {
return
}
// GetIntenternalChan returns the internal connection chanel
func (db *StorDBService) GetIntenternalChan() (conn chan rpcclient.ClientConnector) {
return nil
}
// Reload handles the change of config
func (db *StorDBService) Reload() (err error) {
db.Lock()

View File

@@ -91,11 +91,6 @@ func (thrs *ThresholdService) Start() (err error) {
return
}
// GetIntenternalChan returns the internal connection chanel
func (thrs *ThresholdService) GetIntenternalChan() (conn chan rpcclient.ClientConnector) {
return thrs.connChan
}
// Reload handles the change of config
func (thrs *ThresholdService) Reload() (err error) {
thrs.Lock()

View File

@@ -380,8 +380,6 @@ type Service interface {
Reload() error
// Shutdown stops the service
Shutdown() error
// GetIntenternalChan returns the internal connection chanel
GetIntenternalChan() chan rpcclient.ClientConnector
// IsRunning returns if the service is running
IsRunning() bool
// ShouldRun returns if the service should be running