diff --git a/apier/v1/resourcesv1.go b/apier/v1/resourcesv1.go index 00440c923..6a909f091 100644 --- a/apier/v1/resourcesv1.go +++ b/apier/v1/resourcesv1.go @@ -60,7 +60,7 @@ func (rsv1 *ResourceSV1) Call(serviceMethod string, args interface{}, reply inte return err } -// GetLimitsForEvent returns ResourceLimits matching a specific event +// GetResourcesForEvent returns Resources matching a specific event func (rsv1 *ResourceSV1) GetResourcesForEvent(ev map[string]interface{}, reply *[]*engine.ResourceCfg) error { return rsv1.rls.V1ResourcesForEvent(ev, reply) } diff --git a/cmd/cgr-engine/rater.go b/cmd/cgr-engine/rater.go index ad4879d15..74ed41bfd 100755 --- a/cmd/cgr-engine/rater.go +++ b/cmd/cgr-engine/rater.go @@ -82,7 +82,7 @@ func startRater(internalRaterChan chan rpcclient.RpcClientConnection, cacheDoneC if cCfg, has := cfg.CacheConfig[utils.CacheReverseAliases]; !has || !cCfg.Precache { rvAlsIDs = make([]string, 0) } - if cCfg, has := cfg.CacheConfig[utils.CacheResourceLimits]; !has || !cCfg.Precache { + if cCfg, has := cfg.CacheConfig[utils.CacheResources]; !has || !cCfg.Precache { rlIDs = make([]string, 0) } // ToDo: Add here timings diff --git a/config/config_defaults.go b/config/config_defaults.go index 33a733a3f..35baf29fb 100755 --- a/config/config_defaults.go +++ b/config/config_defaults.go @@ -64,7 +64,7 @@ const CGRATES_CFG_JSON = ` "aliases": {"limit": 0, "ttl": "0s", "static_ttl": false, "precache": false}, // control aliases caching "reverse_aliases": {"limit": 0, "ttl": "0s", "static_ttl": false, "precache": false}, // control reverse aliases index caching "derived_chargers": {"limit": 0, "ttl": "0s", "static_ttl": false, "precache": false}, // control derived charging rule caching - "resource_limits": {"limit": 0, "ttl": "0s", "static_ttl": false, "precache": false}, // control resource limits caching + "resources": {"limit": 0, "ttl": "0s", "static_ttl": false, "precache": false}, // control resource caching "timings": {"limit": 0, "ttl": "0s", "static_ttl": false, "precache": false}, // control timings caching }, @@ -284,7 +284,7 @@ const CGRATES_CFG_JSON = ` "cdrs_conns": [ {"address": "*internal"} // address where to reach CDR Server, empty to disable CDR capturing <*internal|x.y.z.y:1234> ], - "rls_conns": [], // address where to reach the ResourceLimiter service, empty to disable functionality: <""|*internal|x.y.z.y:1234> + "resources_conns": [], // address where to reach the ResourceLimiter service, empty to disable functionality: <""|*internal|x.y.z.y:1234> "create_cdr": false, // create CDR out of events and sends them to CDRS component "extra_fields": [], // extra fields to store in auth/CDRs when creating them "debit_interval": "10s", // interval to perform debits on. @@ -311,7 +311,7 @@ const CGRATES_CFG_JSON = ` "cdrs_conns": [ {"address": "*internal"} // address where to reach CDR Server, empty to disable CDR capturing <*internal|x.y.z.y:1234> ], - "rls_conns": [], // address where to reach the ResourceLimiter service, empty to disable functionality: <""|*internal|x.y.z.y:1234> + "resources_conns": [], // address where to reach the ResourceLimiter service, empty to disable functionality: <""|*internal|x.y.z.y:1234> "create_cdr": false, // create CDR out of events and sends them to CDRS component "debit_interval": "10s", // interval to perform debits on. "min_call_duration": "0s", // only authorize calls with allowed duration higher than this @@ -404,7 +404,7 @@ const CGRATES_CFG_JSON = ` }, -"rls": { +"resources": { "enabled": false, // starts ResourceLimiter service: . "stats_conns": [], // address where to reach the stats service, empty to disable stats functionality: <""|*internal|x.y.z.y:1234> "store_interval": "0s", // dump cache regularly to dataDB, 0 - dump at start/shutdown: <""|*never|$dur> diff --git a/config/config_json.go b/config/config_json.go index a76225638..5159ecc0b 100644 --- a/config/config_json.go +++ b/config/config_json.go @@ -55,7 +55,7 @@ const ( PUBSUBSERV_JSN = "pubsubs" ALIASESSERV_JSN = "aliases" USERSERV_JSN = "users" - RESOURCELIMITER_JSON = "rls" + RESOURCELIMITER_JSON = "resources" MAILER_JSN = "mailer" SURETAX_JSON = "suretax" ) diff --git a/config/config_json_test.go b/config/config_json_test.go index 9c3597968..cbea6fbff 100755 --- a/config/config_json_test.go +++ b/config/config_json_test.go @@ -109,7 +109,7 @@ func TestCacheJsonCfg(t *testing.T) { utils.CacheDerivedChargers: &CacheParamJsonCfg{Limit: utils.IntPointer(0), Ttl: utils.StringPointer("0s"), Static_ttl: utils.BoolPointer(false), Precache: utils.BoolPointer(false)}, - utils.CacheResourceLimits: &CacheParamJsonCfg{Limit: utils.IntPointer(0), + utils.CacheResources: &CacheParamJsonCfg{Limit: utils.IntPointer(0), Ttl: utils.StringPointer("0s"), Static_ttl: utils.BoolPointer(false), Precache: utils.BoolPointer(false)}, utils.CacheTimings: &CacheParamJsonCfg{Limit: utils.IntPointer(0), @@ -457,7 +457,7 @@ func TestSmFsJsonCfg(t *testing.T) { &HaPoolJsonCfg{ Address: utils.StringPointer(utils.MetaInternal), }}, - Rls_conns: &[]*HaPoolJsonCfg{}, + Resources_conns: &[]*HaPoolJsonCfg{}, Create_cdr: utils.BoolPointer(false), Extra_fields: utils.StringSlicePointer([]string{}), Debit_interval: utils.StringPointer("10s"), @@ -495,7 +495,7 @@ func TestSmKamJsonCfg(t *testing.T) { &HaPoolJsonCfg{ Address: utils.StringPointer(utils.MetaInternal), }}, - Rls_conns: &[]*HaPoolJsonCfg{}, + Resources_conns: &[]*HaPoolJsonCfg{}, Create_cdr: utils.BoolPointer(false), Debit_interval: utils.StringPointer("10s"), Min_call_duration: utils.StringPointer("0s"), diff --git a/config/config_test.go b/config/config_test.go index b57dec8dd..28a84f019 100755 --- a/config/config_test.go +++ b/config/config_test.go @@ -432,7 +432,7 @@ func TestCgrCfgJSONDefaultsCacheCFG(t *testing.T) { TTL: time.Duration(0 * time.Second), StaticTTL: false, Precache: false}, utils.CacheDerivedChargers: &CacheParamConfig{Limit: 0, TTL: time.Duration(0 * time.Second), StaticTTL: false, Precache: false}, - utils.CacheResourceLimits: &CacheParamConfig{Limit: 0, + utils.CacheResources: &CacheParamConfig{Limit: 0, TTL: time.Duration(0 * time.Second), StaticTTL: false, Precache: false}, utils.CacheTimings: &CacheParamConfig{Limit: 0, TTL: time.Duration(0 * time.Second), StaticTTL: false, Precache: false}, @@ -566,11 +566,11 @@ func TestCgrCfgJSONDefaultsResLimCfg(t *testing.T) { func TestCgrCfgJSONDefaultStatsCfg(t *testing.T) { eStatsCfg := &StatSCfg{ - Enabled: false, + Enabled: false, StoreInterval: 0, } if !reflect.DeepEqual(cgrCfg.statsCfg, eStatsCfg) { - t.Errorf("received: %+v, expecting: %+v", cgrCfg.statsCfg, eStatsCfg) + t.Errorf("received: %+v, expecting: %+v", cgrCfg.statsCfg, eStatsCfg) } } diff --git a/config/libconfig_json.go b/config/libconfig_json.go index 3a6f83d9d..b908bf4c8 100755 --- a/config/libconfig_json.go +++ b/config/libconfig_json.go @@ -205,7 +205,7 @@ type SmFsJsonCfg struct { Enabled *bool Rals_conns *[]*HaPoolJsonCfg Cdrs_conns *[]*HaPoolJsonCfg - Rls_conns *[]*HaPoolJsonCfg + Resources_conns *[]*HaPoolJsonCfg Create_cdr *bool Extra_fields *[]string Debit_interval *string @@ -264,7 +264,7 @@ type SmKamJsonCfg struct { Enabled *bool Rals_conns *[]*HaPoolJsonCfg Cdrs_conns *[]*HaPoolJsonCfg - Rls_conns *[]*HaPoolJsonCfg + Resources_conns *[]*HaPoolJsonCfg Create_cdr *bool Debit_interval *string Min_call_duration *string diff --git a/config/smconfig.go b/config/smconfig.go index 98f7a5489..2f55bf4be 100644 --- a/config/smconfig.go +++ b/config/smconfig.go @@ -217,9 +217,9 @@ func (self *SmFsConfig) loadFromJsonCfg(jsnCfg *SmFsJsonCfg) error { self.CDRsConns[idx].loadFromJsonCfg(jsnHaCfg) } } - if jsnCfg.Rls_conns != nil { - self.RLsConns = make([]*HaPoolConfig, len(*jsnCfg.Rls_conns)) - for idx, jsnHaCfg := range *jsnCfg.Rls_conns { + if jsnCfg.Resources_conns != nil { + self.RLsConns = make([]*HaPoolConfig, len(*jsnCfg.Resources_conns)) + for idx, jsnHaCfg := range *jsnCfg.Resources_conns { self.RLsConns[idx] = NewDfltHaPoolConfig() self.RLsConns[idx].loadFromJsonCfg(jsnHaCfg) } @@ -347,9 +347,9 @@ func (self *SmKamConfig) loadFromJsonCfg(jsnCfg *SmKamJsonCfg) error { self.CDRsConns[idx].loadFromJsonCfg(jsnHaCfg) } } - if jsnCfg.Rls_conns != nil { - self.RLsConns = make([]*HaPoolConfig, len(*jsnCfg.Rls_conns)) - for idx, jsnHaCfg := range *jsnCfg.Rls_conns { + if jsnCfg.Resources_conns != nil { + self.RLsConns = make([]*HaPoolConfig, len(*jsnCfg.Resources_conns)) + for idx, jsnHaCfg := range *jsnCfg.Resources_conns { self.RLsConns[idx] = NewDfltHaPoolConfig() self.RLsConns[idx].loadFromJsonCfg(jsnHaCfg) } diff --git a/data/conf/samples/reslimiter/cgrates.json b/data/conf/samples/reslimiter/cgrates.json index 2435d6a75..2a987c829 100644 --- a/data/conf/samples/reslimiter/cgrates.json +++ b/data/conf/samples/reslimiter/cgrates.json @@ -28,7 +28,7 @@ }, -"rls": { +"resources": { "enabled": true, "stats_conns": [ //{"address": "*internal"} diff --git a/utils/consts.go b/utils/consts.go index 57fc02351..fdbd1dc00 100755 --- a/utils/consts.go +++ b/utils/consts.go @@ -54,7 +54,7 @@ var ( CacheAliases: ALIASES_PREFIX, CacheReverseAliases: REVERSE_ALIASES_PREFIX, CacheDerivedChargers: DERIVEDCHARGERS_PREFIX, - CacheResourceLimits: ResourceLimitsPrefix, + CacheResources: ResourceLimitsPrefix, CacheTimings: TimingsPrefix, } CachePrefixToInstance map[string]string // will be built on init @@ -420,7 +420,7 @@ const ( CacheAliases = "aliases" CacheReverseAliases = "reverse_aliases" CacheDerivedChargers = "derived_chargers" - CacheResourceLimits = "resource_limits" + CacheResources = "resources" CacheTimings = "timings" StatS = "stats" CostSource = "CostSource"