mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-15 05:09:54 +05:00
AccountS service skel
This commit is contained in:
68
accounts/accounts.go
Normal file
68
accounts/accounts.go
Normal file
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
Real-time Online/Offline Charging System (OerS) for Telecom & ISP environments
|
||||
Copyright (C) ITsysCOM GmbH
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package accounts
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/cgrates/cgrates/config"
|
||||
"github.com/cgrates/cgrates/engine"
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
)
|
||||
|
||||
// NewAccountS instantiates the AccountS
|
||||
func NewAccountS(cfg *config.CGRConfig, fltrS *engine.FilterS, dm *engine.DataManager) *AccountS {
|
||||
return &AccountS{
|
||||
cfg: cfg,
|
||||
fltrS: fltrS,
|
||||
dm: dm,
|
||||
}
|
||||
}
|
||||
|
||||
// AccountS operates Accounts
|
||||
type AccountS struct {
|
||||
cfg *config.CGRConfig
|
||||
fltrS *engine.FilterS
|
||||
dm *engine.DataManager
|
||||
}
|
||||
|
||||
// ListenAndServe keeps the service alive
|
||||
func (aS *AccountS) ListenAndServe(stopChan, cfgRld chan struct{}) {
|
||||
utils.Logger.Info(fmt.Sprintf("<%s> starting <%s>",
|
||||
utils.CoreS, utils.AccountS))
|
||||
for {
|
||||
select {
|
||||
case <-stopChan:
|
||||
return
|
||||
case rld := <-cfgRld: // configuration was reloaded
|
||||
cfgRld <- rld
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Shutdown is called to shutdown the service
|
||||
func (aS *AccountS) Shutdown() (err error) {
|
||||
utils.Logger.Info(fmt.Sprintf("<%s> shutdown <%s>", utils.CoreS, utils.AccountS))
|
||||
return
|
||||
}
|
||||
|
||||
// Call implements rpcclient.ClientConnector interface for internal RPC
|
||||
func (aS *AccountS) Call(serviceMethod string, args interface{}, reply interface{}) error {
|
||||
return utils.RPCCall(aS, serviceMethod, args, reply)
|
||||
}
|
||||
@@ -1,2 +1,2 @@
|
||||
#Tenant,ID,FilterIDs,ActivationInterval,Weight,BalanceID,BalanceFilterIDs,BalanceType,BalanceOpts,BalanceWeight,BalanceValue
|
||||
#Tenant,ID,FilterIDs,ActivationInterval,Weight,BalanceID,BalanceFilterIDs,BalanceWeight,BalanceBlocker,BalanceType,BalanceOpts,BalanceValue
|
||||
|
||||
|
||||
|
@@ -530,6 +530,7 @@ const (
|
||||
MetaFile = "*file"
|
||||
Accounts = "Accounts"
|
||||
AccountService = "AccountS"
|
||||
AccountS = "AccountS"
|
||||
Actions = "Actions"
|
||||
ActionPlans = "ActionPlans"
|
||||
ActionTriggers = "ActionTriggers"
|
||||
|
||||
Reference in New Issue
Block a user