mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Updated cache reload
This commit is contained in:
committed by
Dan Christian Bogos
parent
9bf2d871d4
commit
1083c0315f
@@ -138,7 +138,7 @@ func (api *APIerSv1) RemoveActionTiming(attrs AttrRemoveActionTiming, reply *str
|
||||
if err := api.ConnMgr.Call(api.Config.ApierCfg().CachesConns, nil,
|
||||
utils.CacheSv1ReloadCache, utils.AttrReloadCacheWithArgDispatcher{
|
||||
AttrReloadCache: utils.AttrReloadCache{
|
||||
ArgsCache: utils.ArgsCache{ActionPlanIDs: &[]string{attrs.ActionPlanId}},
|
||||
ArgsCache: utils.ArgsCache{ActionPlanIDs: []string{attrs.ActionPlanId}},
|
||||
},
|
||||
}, reply); err != nil {
|
||||
return 0, err
|
||||
@@ -152,7 +152,7 @@ func (api *APIerSv1) RemoveActionTiming(attrs AttrRemoveActionTiming, reply *str
|
||||
if err := api.ConnMgr.Call(api.Config.ApierCfg().CachesConns, nil,
|
||||
utils.CacheSv1ReloadCache, utils.AttrReloadCacheWithArgDispatcher{
|
||||
AttrReloadCache: utils.AttrReloadCache{
|
||||
ArgsCache: utils.ArgsCache{AccountActionPlanIDs: &remAcntAPids},
|
||||
ArgsCache: utils.ArgsCache{AccountActionPlanIDs: remAcntAPids},
|
||||
},
|
||||
}, reply); err != nil {
|
||||
return 0, err
|
||||
@@ -252,7 +252,7 @@ func (api *APIerSv1) SetAccount(attr utils.AttrSetAccount, reply *string) (err e
|
||||
if err := api.ConnMgr.Call(api.Config.ApierCfg().CachesConns, nil,
|
||||
utils.CacheSv1ReloadCache, utils.AttrReloadCacheWithArgDispatcher{
|
||||
AttrReloadCache: utils.AttrReloadCache{
|
||||
ArgsCache: utils.ArgsCache{AccountActionPlanIDs: &[]string{accID}, ActionPlanIDs: &apIDs},
|
||||
ArgsCache: utils.ArgsCache{AccountActionPlanIDs: []string{accID}, ActionPlanIDs: apIDs},
|
||||
},
|
||||
}, reply); err != nil {
|
||||
return 0, err
|
||||
@@ -350,7 +350,7 @@ func (api *APIerSv1) RemoveAccount(attr utils.AttrRemoveAccount, reply *string)
|
||||
if err = api.ConnMgr.Call(api.Config.ApierCfg().CachesConns, nil,
|
||||
utils.CacheSv1ReloadCache, utils.AttrReloadCacheWithArgDispatcher{
|
||||
AttrReloadCache: utils.AttrReloadCache{
|
||||
ArgsCache: utils.ArgsCache{AccountActionPlanIDs: &[]string{accID}},
|
||||
ArgsCache: utils.ArgsCache{AccountActionPlanIDs: []string{accID}},
|
||||
},
|
||||
}, reply); err != nil {
|
||||
return
|
||||
|
||||
@@ -156,8 +156,8 @@ func (apiv1 *APIerSv1) SetDestination(attrs utils.AttrSetDestination, reply *str
|
||||
if err := apiv1.ConnMgr.Call(apiv1.Config.ApierCfg().CachesConns, nil,
|
||||
utils.CacheSv1ReloadCache, utils.AttrReloadCacheWithArgDispatcher{
|
||||
AttrReloadCache: utils.AttrReloadCache{
|
||||
ArgsCache: utils.ArgsCache{ReverseDestinationIDs: &dest.Prefixes,
|
||||
DestinationIDs: &[]string{attrs.Id}},
|
||||
ArgsCache: utils.ArgsCache{ReverseDestinationIDs: dest.Prefixes,
|
||||
DestinationIDs: []string{attrs.Id}},
|
||||
},
|
||||
}, reply); err != nil {
|
||||
return err
|
||||
@@ -233,7 +233,7 @@ func (apiv1 *APIerSv1) LoadDestination(attrs AttrLoadDestination, reply *string)
|
||||
if err := apiv1.ConnMgr.Call(apiv1.Config.ApierCfg().CachesConns, nil,
|
||||
utils.CacheSv1ReloadCache, utils.AttrReloadCacheWithArgDispatcher{
|
||||
AttrReloadCache: utils.AttrReloadCache{
|
||||
ArgsCache: utils.ArgsCache{DestinationIDs: &[]string{attrs.ID}},
|
||||
ArgsCache: utils.ArgsCache{DestinationIDs: []string{attrs.ID}},
|
||||
},
|
||||
}, reply); err != nil {
|
||||
return err
|
||||
@@ -691,7 +691,7 @@ func (apiv1 *APIerSv1) SetActionPlan(attrs AttrSetActionPlan, reply *string) (er
|
||||
if err := apiv1.ConnMgr.Call(apiv1.Config.ApierCfg().CachesConns, nil,
|
||||
utils.CacheSv1ReloadCache, utils.AttrReloadCacheWithArgDispatcher{
|
||||
AttrReloadCache: utils.AttrReloadCache{
|
||||
ArgsCache: utils.ArgsCache{ActionPlanIDs: &[]string{ap.Id}},
|
||||
ArgsCache: utils.ArgsCache{ActionPlanIDs: []string{ap.Id}},
|
||||
},
|
||||
}, reply); err != nil {
|
||||
return 0, err
|
||||
@@ -706,7 +706,7 @@ func (apiv1 *APIerSv1) SetActionPlan(attrs AttrSetActionPlan, reply *string) (er
|
||||
if err := apiv1.ConnMgr.Call(apiv1.Config.ApierCfg().CachesConns, nil,
|
||||
utils.CacheSv1ReloadCache, utils.AttrReloadCacheWithArgDispatcher{
|
||||
AttrReloadCache: utils.AttrReloadCache{
|
||||
ArgsCache: utils.ArgsCache{AccountActionPlanIDs: &sl},
|
||||
ArgsCache: utils.ArgsCache{AccountActionPlanIDs: sl},
|
||||
},
|
||||
}, reply); err != nil {
|
||||
return 0, err
|
||||
@@ -807,7 +807,7 @@ func (apiv1 *APIerSv1) RemoveActionPlan(attr AttrGetActionPlan, reply *string) (
|
||||
if err := apiv1.ConnMgr.Call(apiv1.Config.ApierCfg().CachesConns, nil,
|
||||
utils.CacheSv1ReloadCache, utils.AttrReloadCacheWithArgDispatcher{
|
||||
AttrReloadCache: utils.AttrReloadCache{
|
||||
ArgsCache: utils.ArgsCache{AccountActionPlanIDs: &sl},
|
||||
ArgsCache: utils.ArgsCache{AccountActionPlanIDs: sl},
|
||||
},
|
||||
}, reply); err != nil {
|
||||
return 0, err
|
||||
|
||||
@@ -1461,7 +1461,7 @@ func testApierResetDataAfterLoadFromFolder(t *testing.T) {
|
||||
expStats[utils.CacheActionPlans].Items = 7
|
||||
expStats[utils.CacheActions].Items = 5
|
||||
expStats[utils.CacheDestinations].Items = 3
|
||||
expStats[utils.CacheLoadIDs].Items = 14
|
||||
expStats[utils.CacheLoadIDs].Items = 17
|
||||
expStats[utils.CacheRPCConnections].Items = 2
|
||||
if err := rater.Call(utils.CacheSv1GetCacheStats, new(utils.AttrCacheIDsWithArgDispatcher), &rcvStats); err != nil {
|
||||
t.Error("Got error on CacheSv1.GetCacheStats: ", err.Error())
|
||||
|
||||
@@ -132,7 +132,7 @@ func testCacheSAfterLoadFromFolder(t *testing.T) {
|
||||
expStats[utils.CacheActionPlans].Items = 7
|
||||
expStats[utils.CacheActions].Items = 5
|
||||
expStats[utils.CacheDestinations].Items = 3
|
||||
expStats[utils.CacheLoadIDs].Items = 14
|
||||
expStats[utils.CacheLoadIDs].Items = 17
|
||||
expStats[utils.CacheRPCConnections].Items = 2
|
||||
if err := chcRPC.Call(utils.CacheSv1GetCacheStats, &utils.AttrCacheIDsWithArgDispatcher{}, &rcvStats); err != nil {
|
||||
t.Error("Got error on CacheSv1.GetCacheStats: ", err.Error())
|
||||
|
||||
@@ -40,29 +40,29 @@ func composeArgsReload(args utils.ArgsGetCacheItem) (rpl utils.AttrReloadCache)
|
||||
rpl = utils.InitAttrReloadCache()
|
||||
switch args.CacheID {
|
||||
case utils.CacheResourceProfiles:
|
||||
rpl.ResourceProfileIDs = &[]string{args.ItemID}
|
||||
rpl.ResourceProfileIDs = []string{args.ItemID}
|
||||
case utils.CacheResources:
|
||||
rpl.ResourceIDs = &[]string{args.ItemID}
|
||||
rpl.ResourceIDs = []string{args.ItemID}
|
||||
case utils.CacheStatQueues:
|
||||
rpl.StatsQueueIDs = &[]string{args.ItemID}
|
||||
rpl.StatsQueueIDs = []string{args.ItemID}
|
||||
case utils.CacheStatQueueProfiles:
|
||||
rpl.StatsQueueProfileIDs = &[]string{args.ItemID}
|
||||
rpl.StatsQueueProfileIDs = []string{args.ItemID}
|
||||
case utils.CacheThresholds:
|
||||
rpl.ThresholdIDs = &[]string{args.ItemID}
|
||||
rpl.ThresholdIDs = []string{args.ItemID}
|
||||
case utils.CacheThresholdProfiles:
|
||||
rpl.ThresholdProfileIDs = &[]string{args.ItemID}
|
||||
rpl.ThresholdProfileIDs = []string{args.ItemID}
|
||||
case utils.CacheFilters:
|
||||
rpl.FilterIDs = &[]string{args.ItemID}
|
||||
rpl.FilterIDs = []string{args.ItemID}
|
||||
case utils.CacheSupplierProfiles:
|
||||
rpl.SupplierProfileIDs = &[]string{args.ItemID}
|
||||
rpl.SupplierProfileIDs = []string{args.ItemID}
|
||||
case utils.CacheAttributeProfiles:
|
||||
rpl.AttributeProfileIDs = &[]string{args.ItemID}
|
||||
rpl.AttributeProfileIDs = []string{args.ItemID}
|
||||
case utils.CacheChargerProfiles:
|
||||
rpl.ChargerProfileIDs = &[]string{args.ItemID}
|
||||
rpl.ChargerProfileIDs = []string{args.ItemID}
|
||||
case utils.CacheDispatcherProfiles:
|
||||
rpl.DispatcherProfileIDs = &[]string{args.ItemID}
|
||||
rpl.DispatcherProfileIDs = []string{args.ItemID}
|
||||
case utils.CacheDispatcherHosts:
|
||||
rpl.DispatcherHostIDs = &[]string{args.ItemID}
|
||||
rpl.DispatcherHostIDs = []string{args.ItemID}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@ func (apiv2 *APIerSv2) SetAccount(attr AttrSetAccount, reply *string) error {
|
||||
return 0, apiv2.ConnMgr.Call(apiv2.Config.ApierCfg().CachesConns, nil,
|
||||
utils.CacheSv1ReloadCache, utils.AttrReloadCacheWithArgDispatcher{
|
||||
AttrReloadCache: utils.AttrReloadCache{
|
||||
ArgsCache: utils.ArgsCache{AccountActionPlanIDs: &[]string{accID}, ActionPlanIDs: &apIDs},
|
||||
ArgsCache: utils.ArgsCache{AccountActionPlanIDs: []string{accID}, ActionPlanIDs: apIDs},
|
||||
},
|
||||
}, reply)
|
||||
}, config.CgrConfig().GeneralCfg().LockingTimeout, utils.ACTION_PLAN_PREFIX)
|
||||
|
||||
265
engine/caches.go
265
engine/caches.go
@@ -212,11 +212,8 @@ func (chS *CacheS) V1RemoveGroup(args *utils.ArgsGetGroupWithArgDispatcher,
|
||||
return
|
||||
}
|
||||
|
||||
func (chS *CacheS) reloadCache(chID string, IDs *[]string) error {
|
||||
if IDs == nil {
|
||||
return chS.dm.CacheDataFromDB(chID, nil, true) // Reload all
|
||||
}
|
||||
return chS.dm.CacheDataFromDB(chID, *IDs, true)
|
||||
func (chS *CacheS) reloadCache(chID string, IDs []string) error {
|
||||
return chS.dm.CacheDataFromDB(chID, IDs, true)
|
||||
}
|
||||
|
||||
func (chS *CacheS) V1ReloadCache(attrs utils.AttrReloadCacheWithArgDispatcher, reply *string) (err error) {
|
||||
@@ -224,89 +221,131 @@ func (chS *CacheS) V1ReloadCache(attrs utils.AttrReloadCacheWithArgDispatcher, r
|
||||
Cache.Clear(nil)
|
||||
return
|
||||
}
|
||||
// Reload Destinations
|
||||
if err = chS.reloadCache(utils.DESTINATION_PREFIX, attrs.DestinationIDs); err != nil {
|
||||
return
|
||||
if len(attrs.DestinationIDs) != 0 {
|
||||
// Reload Destinations
|
||||
if err = chS.reloadCache(utils.DESTINATION_PREFIX, attrs.DestinationIDs); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
// Reload ReverseDestinations
|
||||
if err = chS.reloadCache(utils.REVERSE_DESTINATION_PREFIX, attrs.ReverseDestinationIDs); err != nil {
|
||||
return
|
||||
if len(attrs.ReverseDestinationIDs) != 0 {
|
||||
// Reload ReverseDestinations
|
||||
if err = chS.reloadCache(utils.REVERSE_DESTINATION_PREFIX, attrs.ReverseDestinationIDs); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
// RatingPlans
|
||||
if err = chS.reloadCache(utils.RATING_PLAN_PREFIX, attrs.RatingPlanIDs); err != nil {
|
||||
return
|
||||
if len(attrs.RatingPlanIDs) != 0 {
|
||||
// RatingPlans
|
||||
if err = chS.reloadCache(utils.RATING_PLAN_PREFIX, attrs.RatingPlanIDs); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
// RatingProfiles
|
||||
if err = chS.reloadCache(utils.RATING_PROFILE_PREFIX, attrs.RatingProfileIDs); err != nil {
|
||||
return
|
||||
if len(attrs.RatingProfileIDs) != 0 {
|
||||
// RatingProfiles
|
||||
if err = chS.reloadCache(utils.RATING_PROFILE_PREFIX, attrs.RatingProfileIDs); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
// Actions
|
||||
if err = chS.reloadCache(utils.ACTION_PREFIX, attrs.ActionIDs); err != nil {
|
||||
return
|
||||
if len(attrs.ActionIDs) != 0 {
|
||||
// Actions
|
||||
if err = chS.reloadCache(utils.ACTION_PREFIX, attrs.ActionIDs); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
// ActionPlans
|
||||
if err = chS.reloadCache(utils.ACTION_PLAN_PREFIX, attrs.ActionPlanIDs); err != nil {
|
||||
return
|
||||
if len(attrs.ActionPlanIDs) != 0 {
|
||||
// ActionPlans
|
||||
if err = chS.reloadCache(utils.ACTION_PLAN_PREFIX, attrs.ActionPlanIDs); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
// AccountActionPlans
|
||||
if err = chS.reloadCache(utils.AccountActionPlansPrefix, attrs.AccountActionPlanIDs); err != nil {
|
||||
return
|
||||
if len(attrs.AccountActionPlanIDs) != 0 {
|
||||
// AccountActionPlans
|
||||
if err = chS.reloadCache(utils.AccountActionPlansPrefix, attrs.AccountActionPlanIDs); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
// ActionTriggers
|
||||
if err = chS.reloadCache(utils.ACTION_TRIGGER_PREFIX, attrs.ActionTriggerIDs); err != nil {
|
||||
return
|
||||
if len(attrs.ActionTriggerIDs) != 0 {
|
||||
// ActionTriggers
|
||||
if err = chS.reloadCache(utils.ACTION_TRIGGER_PREFIX, attrs.ActionTriggerIDs); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
// SharedGroups
|
||||
if err = chS.reloadCache(utils.SHARED_GROUP_PREFIX, attrs.SharedGroupIDs); err != nil {
|
||||
return
|
||||
if len(attrs.SharedGroupIDs) != 0 {
|
||||
// SharedGroups
|
||||
if err = chS.reloadCache(utils.SHARED_GROUP_PREFIX, attrs.SharedGroupIDs); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
// ResourceProfiles
|
||||
if err = chS.reloadCache(utils.ResourceProfilesPrefix, attrs.ResourceProfileIDs); err != nil {
|
||||
return
|
||||
if len(attrs.ResourceProfileIDs) != 0 {
|
||||
// ResourceProfiles
|
||||
if err = chS.reloadCache(utils.ResourceProfilesPrefix, attrs.ResourceProfileIDs); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
// Resources
|
||||
if err = chS.reloadCache(utils.ResourcesPrefix, attrs.ResourceIDs); err != nil {
|
||||
return
|
||||
if len(attrs.ResourceIDs) != 0 {
|
||||
// Resources
|
||||
if err = chS.reloadCache(utils.ResourcesPrefix, attrs.ResourceIDs); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
// StatQueues
|
||||
if err = chS.reloadCache(utils.StatQueuePrefix, attrs.StatsQueueIDs); err != nil {
|
||||
return
|
||||
if len(attrs.StatsQueueIDs) != 0 {
|
||||
// StatQueues
|
||||
if err = chS.reloadCache(utils.StatQueuePrefix, attrs.StatsQueueIDs); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
// StatQueueProfiles
|
||||
if err = chS.reloadCache(utils.StatQueueProfilePrefix, attrs.StatsQueueProfileIDs); err != nil {
|
||||
return
|
||||
if len(attrs.StatsQueueProfileIDs) != 0 {
|
||||
// StatQueueProfiles
|
||||
if err = chS.reloadCache(utils.StatQueueProfilePrefix, attrs.StatsQueueProfileIDs); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
// Thresholds
|
||||
if err = chS.reloadCache(utils.ThresholdPrefix, attrs.ThresholdIDs); err != nil {
|
||||
return
|
||||
if len(attrs.ThresholdIDs) != 0 {
|
||||
// Thresholds
|
||||
if err = chS.reloadCache(utils.ThresholdPrefix, attrs.ThresholdIDs); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
// ThresholdProfiles
|
||||
if err = chS.reloadCache(utils.ThresholdProfilePrefix, attrs.ThresholdProfileIDs); err != nil {
|
||||
return
|
||||
if len(attrs.ThresholdProfileIDs) != 0 {
|
||||
// ThresholdProfiles
|
||||
if err = chS.reloadCache(utils.ThresholdProfilePrefix, attrs.ThresholdProfileIDs); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
// Filters
|
||||
if err = chS.reloadCache(utils.FilterPrefix, attrs.FilterIDs); err != nil {
|
||||
return
|
||||
if len(attrs.FilterIDs) != 0 {
|
||||
// Filters
|
||||
if err = chS.reloadCache(utils.FilterPrefix, attrs.FilterIDs); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
// SupplierProfile
|
||||
if err = chS.reloadCache(utils.SupplierProfilePrefix, attrs.SupplierProfileIDs); err != nil {
|
||||
return
|
||||
if len(attrs.SupplierProfileIDs) != 0 {
|
||||
// SupplierProfile
|
||||
if err = chS.reloadCache(utils.SupplierProfilePrefix, attrs.SupplierProfileIDs); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
// AttributeProfile
|
||||
if err = chS.reloadCache(utils.AttributeProfilePrefix, attrs.AttributeProfileIDs); err != nil {
|
||||
return
|
||||
if len(attrs.AttributeProfileIDs) != 0 {
|
||||
// AttributeProfile
|
||||
if err = chS.reloadCache(utils.AttributeProfilePrefix, attrs.AttributeProfileIDs); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
// ChargerProfiles
|
||||
if err = chS.reloadCache(utils.ChargerProfilePrefix, attrs.ChargerProfileIDs); err != nil {
|
||||
return
|
||||
if len(attrs.ChargerProfileIDs) != 0 {
|
||||
// ChargerProfiles
|
||||
if err = chS.reloadCache(utils.ChargerProfilePrefix, attrs.ChargerProfileIDs); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
// DispatcherProfile
|
||||
if err = chS.reloadCache(utils.DispatcherProfilePrefix, attrs.DispatcherProfileIDs); err != nil {
|
||||
return
|
||||
if len(attrs.DispatcherProfileIDs) != 0 {
|
||||
// DispatcherProfile
|
||||
if err = chS.reloadCache(utils.DispatcherProfilePrefix, attrs.DispatcherProfileIDs); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
// DispatcherHosts
|
||||
if err = chS.reloadCache(utils.DispatcherHostPrefix, attrs.DispatcherHostIDs); err != nil {
|
||||
return
|
||||
if len(attrs.DispatcherHostIDs) != 0 {
|
||||
// DispatcherHosts
|
||||
if err = chS.reloadCache(utils.DispatcherHostPrefix, attrs.DispatcherHostIDs); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
//get loadIDs from database for all types
|
||||
@@ -340,27 +379,27 @@ func (chS *CacheS) V1LoadCache(args utils.AttrReloadCacheWithArgDispatcher, repl
|
||||
Cache.Clear(nil)
|
||||
}
|
||||
if err := chS.dm.LoadDataDBCache(
|
||||
toStringSlice(args.DestinationIDs),
|
||||
toStringSlice(args.ReverseDestinationIDs),
|
||||
toStringSlice(args.RatingPlanIDs),
|
||||
toStringSlice(args.RatingProfileIDs),
|
||||
toStringSlice(args.ActionIDs),
|
||||
toStringSlice(args.ActionPlanIDs),
|
||||
toStringSlice(args.AccountActionPlanIDs),
|
||||
toStringSlice(args.ActionTriggerIDs),
|
||||
toStringSlice(args.SharedGroupIDs),
|
||||
toStringSlice(args.ResourceProfileIDs),
|
||||
toStringSlice(args.ResourceIDs),
|
||||
toStringSlice(args.StatsQueueIDs),
|
||||
toStringSlice(args.StatsQueueProfileIDs),
|
||||
toStringSlice(args.ThresholdIDs),
|
||||
toStringSlice(args.ThresholdProfileIDs),
|
||||
toStringSlice(args.FilterIDs),
|
||||
toStringSlice(args.SupplierProfileIDs),
|
||||
toStringSlice(args.AttributeProfileIDs),
|
||||
toStringSlice(args.ChargerProfileIDs),
|
||||
toStringSlice(args.DispatcherProfileIDs),
|
||||
toStringSlice(args.DispatcherHostIDs),
|
||||
args.DestinationIDs,
|
||||
args.ReverseDestinationIDs,
|
||||
args.RatingPlanIDs,
|
||||
args.RatingProfileIDs,
|
||||
args.ActionIDs,
|
||||
args.ActionPlanIDs,
|
||||
args.AccountActionPlanIDs,
|
||||
args.ActionTriggerIDs,
|
||||
args.SharedGroupIDs,
|
||||
args.ResourceProfileIDs,
|
||||
args.ResourceIDs,
|
||||
args.StatsQueueIDs,
|
||||
args.StatsQueueProfileIDs,
|
||||
args.ThresholdIDs,
|
||||
args.ThresholdProfileIDs,
|
||||
args.FilterIDs,
|
||||
args.SupplierProfileIDs,
|
||||
args.AttributeProfileIDs,
|
||||
args.ChargerProfileIDs,
|
||||
args.DispatcherProfileIDs,
|
||||
args.DispatcherHostIDs,
|
||||
); err != nil {
|
||||
return utils.NewErrServerError(err)
|
||||
}
|
||||
@@ -382,12 +421,8 @@ func (chS *CacheS) V1LoadCache(args utils.AttrReloadCacheWithArgDispatcher, repl
|
||||
return nil
|
||||
}
|
||||
|
||||
func flushCache(chID string, IDs *[]string) {
|
||||
if IDs == nil {
|
||||
Cache.Clear([]string{chID})
|
||||
return
|
||||
}
|
||||
for _, key := range *IDs {
|
||||
func flushCache(chID string, IDs []string) {
|
||||
for _, key := range IDs {
|
||||
Cache.Remove(chID, key, true, utils.NonTransactional)
|
||||
}
|
||||
}
|
||||
@@ -438,64 +473,64 @@ func (chS *CacheS) V1FlushCache(args utils.AttrReloadCacheWithArgDispatcher, rep
|
||||
func populateCacheLoadIDs(loadIDs map[string]int64, attrs utils.AttrReloadCache) (cacheLoadIDs map[string]int64) {
|
||||
cacheLoadIDs = make(map[string]int64)
|
||||
//based on IDs of each type populate cacheLoadIDs and add into cache
|
||||
if attrs.DestinationIDs == nil || len(*attrs.DestinationIDs) != 0 {
|
||||
if attrs.DestinationIDs == nil || len(attrs.DestinationIDs) != 0 {
|
||||
cacheLoadIDs[utils.CacheDestinations] = loadIDs[utils.CacheDestinations]
|
||||
}
|
||||
if attrs.ReverseDestinationIDs == nil || len(*attrs.ReverseDestinationIDs) != 0 {
|
||||
if attrs.ReverseDestinationIDs == nil || len(attrs.ReverseDestinationIDs) != 0 {
|
||||
cacheLoadIDs[utils.CacheReverseDestinations] = loadIDs[utils.CacheReverseDestinations]
|
||||
}
|
||||
if attrs.RatingPlanIDs == nil || len(*attrs.RatingPlanIDs) != 0 {
|
||||
if attrs.RatingPlanIDs == nil || len(attrs.RatingPlanIDs) != 0 {
|
||||
cacheLoadIDs[utils.CacheRatingPlans] = loadIDs[utils.CacheRatingPlans]
|
||||
}
|
||||
if attrs.RatingProfileIDs == nil || len(*attrs.RatingProfileIDs) != 0 {
|
||||
if attrs.RatingProfileIDs == nil || len(attrs.RatingProfileIDs) != 0 {
|
||||
cacheLoadIDs[utils.CacheRatingProfiles] = loadIDs[utils.CacheRatingProfiles]
|
||||
}
|
||||
if attrs.ActionIDs == nil || len(*attrs.ActionIDs) != 0 {
|
||||
if attrs.ActionIDs == nil || len(attrs.ActionIDs) != 0 {
|
||||
cacheLoadIDs[utils.CacheActions] = loadIDs[utils.CacheActions]
|
||||
}
|
||||
if attrs.ActionPlanIDs == nil || len(*attrs.ActionPlanIDs) != 0 {
|
||||
if attrs.ActionPlanIDs == nil || len(attrs.ActionPlanIDs) != 0 {
|
||||
cacheLoadIDs[utils.CacheActionPlans] = loadIDs[utils.CacheActionPlans]
|
||||
}
|
||||
if attrs.AccountActionPlanIDs == nil || len(*attrs.AccountActionPlanIDs) != 0 {
|
||||
if attrs.AccountActionPlanIDs == nil || len(attrs.AccountActionPlanIDs) != 0 {
|
||||
cacheLoadIDs[utils.CacheAccountActionPlans] = loadIDs[utils.CacheAccountActionPlans]
|
||||
}
|
||||
if attrs.ActionTriggerIDs == nil || len(*attrs.ActionTriggerIDs) != 0 {
|
||||
if attrs.ActionTriggerIDs == nil || len(attrs.ActionTriggerIDs) != 0 {
|
||||
cacheLoadIDs[utils.CacheActionTriggers] = loadIDs[utils.CacheActionTriggers]
|
||||
}
|
||||
if attrs.SharedGroupIDs == nil || len(*attrs.SharedGroupIDs) != 0 {
|
||||
if attrs.SharedGroupIDs == nil || len(attrs.SharedGroupIDs) != 0 {
|
||||
cacheLoadIDs[utils.CacheSharedGroups] = loadIDs[utils.CacheSharedGroups]
|
||||
}
|
||||
if attrs.ResourceProfileIDs == nil || len(*attrs.ResourceProfileIDs) != 0 {
|
||||
if attrs.ResourceProfileIDs == nil || len(attrs.ResourceProfileIDs) != 0 {
|
||||
cacheLoadIDs[utils.CacheResourceProfiles] = loadIDs[utils.CacheResourceProfiles]
|
||||
}
|
||||
if attrs.ResourceIDs == nil || len(*attrs.ResourceIDs) != 0 {
|
||||
if attrs.ResourceIDs == nil || len(attrs.ResourceIDs) != 0 {
|
||||
cacheLoadIDs[utils.CacheResources] = loadIDs[utils.CacheResources]
|
||||
}
|
||||
if attrs.StatsQueueProfileIDs == nil || len(*attrs.StatsQueueProfileIDs) != 0 {
|
||||
if attrs.StatsQueueProfileIDs == nil || len(attrs.StatsQueueProfileIDs) != 0 {
|
||||
cacheLoadIDs[utils.CacheStatQueueProfiles] = loadIDs[utils.CacheStatQueueProfiles]
|
||||
}
|
||||
if attrs.StatsQueueIDs == nil || len(*attrs.StatsQueueIDs) != 0 {
|
||||
if attrs.StatsQueueIDs == nil || len(attrs.StatsQueueIDs) != 0 {
|
||||
cacheLoadIDs[utils.CacheStatQueues] = loadIDs[utils.CacheStatQueues]
|
||||
}
|
||||
if attrs.ThresholdProfileIDs == nil || len(*attrs.ThresholdProfileIDs) != 0 {
|
||||
if attrs.ThresholdProfileIDs == nil || len(attrs.ThresholdProfileIDs) != 0 {
|
||||
cacheLoadIDs[utils.CacheThresholdProfiles] = loadIDs[utils.CacheThresholdProfiles]
|
||||
}
|
||||
if attrs.ThresholdIDs == nil || len(*attrs.ThresholdIDs) != 0 {
|
||||
if attrs.ThresholdIDs == nil || len(attrs.ThresholdIDs) != 0 {
|
||||
cacheLoadIDs[utils.CacheThresholds] = loadIDs[utils.CacheThresholds]
|
||||
}
|
||||
if attrs.FilterIDs == nil || len(*attrs.FilterIDs) != 0 {
|
||||
if attrs.FilterIDs == nil || len(attrs.FilterIDs) != 0 {
|
||||
cacheLoadIDs[utils.CacheFilters] = loadIDs[utils.CacheFilters]
|
||||
}
|
||||
if attrs.SupplierProfileIDs == nil || len(*attrs.SupplierProfileIDs) != 0 {
|
||||
if attrs.SupplierProfileIDs == nil || len(attrs.SupplierProfileIDs) != 0 {
|
||||
cacheLoadIDs[utils.CacheSupplierProfiles] = loadIDs[utils.CacheSupplierProfiles]
|
||||
}
|
||||
if attrs.AttributeProfileIDs == nil || len(*attrs.AttributeProfileIDs) != 0 {
|
||||
if attrs.AttributeProfileIDs == nil || len(attrs.AttributeProfileIDs) != 0 {
|
||||
cacheLoadIDs[utils.CacheAttributeProfiles] = loadIDs[utils.CacheAttributeProfiles]
|
||||
}
|
||||
if attrs.ChargerProfileIDs == nil || len(*attrs.ChargerProfileIDs) != 0 {
|
||||
if attrs.ChargerProfileIDs == nil || len(attrs.ChargerProfileIDs) != 0 {
|
||||
cacheLoadIDs[utils.CacheChargerProfiles] = loadIDs[utils.CacheChargerProfiles]
|
||||
}
|
||||
if attrs.DispatcherProfileIDs == nil || len(*attrs.DispatcherProfileIDs) != 0 {
|
||||
if attrs.DispatcherProfileIDs == nil || len(attrs.DispatcherProfileIDs) != 0 {
|
||||
cacheLoadIDs[utils.CacheDispatcherProfiles] = loadIDs[utils.CacheDispatcherProfiles]
|
||||
}
|
||||
return
|
||||
|
||||
@@ -2394,27 +2394,27 @@ func (tpr *TpReader) ReloadCache(caching string, verbose bool, argDispatcher *ut
|
||||
ArgDispatcher: argDispatcher,
|
||||
AttrReloadCache: utils.AttrReloadCache{
|
||||
ArgsCache: utils.ArgsCache{
|
||||
DestinationIDs: &dstIds,
|
||||
ReverseDestinationIDs: &revDstIDs,
|
||||
RatingPlanIDs: &rplIds,
|
||||
RatingProfileIDs: &rpfIds,
|
||||
ActionIDs: &actIds,
|
||||
ActionPlanIDs: &aps,
|
||||
AccountActionPlanIDs: &aapIDs,
|
||||
SharedGroupIDs: &shgIds,
|
||||
ResourceProfileIDs: &rspIDs,
|
||||
ResourceIDs: &resIDs,
|
||||
ActionTriggerIDs: &aatIDs,
|
||||
StatsQueueIDs: &stqIDs,
|
||||
StatsQueueProfileIDs: &stqpIDs,
|
||||
ThresholdIDs: &trsIDs,
|
||||
ThresholdProfileIDs: &trspfIDs,
|
||||
FilterIDs: &flrIDs,
|
||||
SupplierProfileIDs: &spfIDs,
|
||||
AttributeProfileIDs: &apfIDs,
|
||||
ChargerProfileIDs: &chargerIDs,
|
||||
DispatcherProfileIDs: &dppIDs,
|
||||
DispatcherHostIDs: &dphIDs,
|
||||
DestinationIDs: dstIds,
|
||||
ReverseDestinationIDs: revDstIDs,
|
||||
RatingPlanIDs: rplIds,
|
||||
RatingProfileIDs: rpfIds,
|
||||
ActionIDs: actIds,
|
||||
ActionPlanIDs: aps,
|
||||
AccountActionPlanIDs: aapIDs,
|
||||
SharedGroupIDs: shgIds,
|
||||
ResourceProfileIDs: rspIDs,
|
||||
ResourceIDs: resIDs,
|
||||
ActionTriggerIDs: aatIDs,
|
||||
StatsQueueIDs: stqIDs,
|
||||
StatsQueueProfileIDs: stqpIDs,
|
||||
ThresholdIDs: trsIDs,
|
||||
ThresholdProfileIDs: trspfIDs,
|
||||
FilterIDs: flrIDs,
|
||||
SupplierProfileIDs: spfIDs,
|
||||
AttributeProfileIDs: apfIDs,
|
||||
ChargerProfileIDs: chargerIDs,
|
||||
DispatcherProfileIDs: dppIDs,
|
||||
DispatcherHostIDs: dphIDs,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -290,7 +290,7 @@ func (ldr *Loader) storeLoadedData(loaderType string,
|
||||
return err
|
||||
}
|
||||
}
|
||||
cacheArgs.AttributeProfileIDs = &ids
|
||||
cacheArgs.AttributeProfileIDs = ids
|
||||
}
|
||||
case utils.MetaResources:
|
||||
for _, lDataSet := range lds {
|
||||
@@ -324,8 +324,8 @@ func (ldr *Loader) storeLoadedData(loaderType string,
|
||||
Usages: make(map[string]*engine.ResourceUsage)}); err != nil {
|
||||
return err
|
||||
}
|
||||
cacheArgs.ResourceProfileIDs = &ids
|
||||
cacheArgs.ResourceIDs = &ids
|
||||
cacheArgs.ResourceProfileIDs = ids
|
||||
cacheArgs.ResourceIDs = ids
|
||||
}
|
||||
}
|
||||
case utils.MetaFilters:
|
||||
@@ -354,7 +354,7 @@ func (ldr *Loader) storeLoadedData(loaderType string,
|
||||
if err := ldr.dm.SetFilter(fltrPrf); err != nil {
|
||||
return err
|
||||
}
|
||||
cacheArgs.FilterIDs = &ids
|
||||
cacheArgs.FilterIDs = ids
|
||||
}
|
||||
}
|
||||
case utils.MetaStats:
|
||||
@@ -393,8 +393,8 @@ func (ldr *Loader) storeLoadedData(loaderType string,
|
||||
if err := ldr.dm.SetStatQueue(&engine.StatQueue{Tenant: stsPrf.Tenant, ID: stsPrf.ID, SQMetrics: metrics}); err != nil {
|
||||
return err
|
||||
}
|
||||
cacheArgs.StatsQueueProfileIDs = &ids
|
||||
cacheArgs.StatsQueueIDs = &ids
|
||||
cacheArgs.StatsQueueProfileIDs = ids
|
||||
cacheArgs.StatsQueueIDs = ids
|
||||
}
|
||||
}
|
||||
case utils.MetaThresholds:
|
||||
@@ -425,8 +425,8 @@ func (ldr *Loader) storeLoadedData(loaderType string,
|
||||
if err := ldr.dm.SetThreshold(&engine.Threshold{Tenant: thPrf.Tenant, ID: thPrf.ID}); err != nil {
|
||||
return err
|
||||
}
|
||||
cacheArgs.ThresholdProfileIDs = &ids
|
||||
cacheArgs.ThresholdIDs = &ids
|
||||
cacheArgs.ThresholdProfileIDs = ids
|
||||
cacheArgs.ThresholdIDs = ids
|
||||
}
|
||||
}
|
||||
case utils.MetaSuppliers:
|
||||
@@ -455,7 +455,7 @@ func (ldr *Loader) storeLoadedData(loaderType string,
|
||||
if err := ldr.dm.SetSupplierProfile(spPrf, true); err != nil {
|
||||
return err
|
||||
}
|
||||
cacheArgs.SupplierProfileIDs = &ids
|
||||
cacheArgs.SupplierProfileIDs = ids
|
||||
}
|
||||
}
|
||||
case utils.MetaChargers:
|
||||
@@ -484,7 +484,7 @@ func (ldr *Loader) storeLoadedData(loaderType string,
|
||||
if err := ldr.dm.SetChargerProfile(cpp, true); err != nil {
|
||||
return err
|
||||
}
|
||||
cacheArgs.ChargerProfileIDs = &ids
|
||||
cacheArgs.ChargerProfileIDs = ids
|
||||
}
|
||||
}
|
||||
case utils.MetaDispatchers:
|
||||
@@ -512,7 +512,7 @@ func (ldr *Loader) storeLoadedData(loaderType string,
|
||||
if err := ldr.dm.SetDispatcherProfile(dsp, true); err != nil {
|
||||
return err
|
||||
}
|
||||
cacheArgs.DispatcherProfileIDs = &ids
|
||||
cacheArgs.DispatcherProfileIDs = ids
|
||||
}
|
||||
}
|
||||
case utils.MetaDispatcherHosts:
|
||||
@@ -537,7 +537,7 @@ func (ldr *Loader) storeLoadedData(loaderType string,
|
||||
if err := ldr.dm.SetDispatcherHost(dsp); err != nil {
|
||||
return err
|
||||
}
|
||||
cacheArgs.DispatcherHostIDs = &ids
|
||||
cacheArgs.DispatcherHostIDs = ids
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -661,7 +661,7 @@ func (ldr *Loader) removeLoadedData(loaderType, tntID, caching string) (err erro
|
||||
utils.NonTransactional, true); err != nil {
|
||||
return err
|
||||
}
|
||||
cacheArgs.AttributeProfileIDs = &ids
|
||||
cacheArgs.AttributeProfileIDs = ids
|
||||
}
|
||||
case utils.MetaResources:
|
||||
if ldr.dryRun {
|
||||
@@ -680,8 +680,8 @@ func (ldr *Loader) removeLoadedData(loaderType, tntID, caching string) (err erro
|
||||
if err := ldr.dm.RemoveResource(tntIDStruct.Tenant, tntIDStruct.ID, utils.NonTransactional); err != nil {
|
||||
return err
|
||||
}
|
||||
cacheArgs.ResourceProfileIDs = &ids
|
||||
cacheArgs.ResourceIDs = &ids
|
||||
cacheArgs.ResourceProfileIDs = ids
|
||||
cacheArgs.ResourceIDs = ids
|
||||
}
|
||||
|
||||
case utils.MetaFilters:
|
||||
@@ -696,7 +696,7 @@ func (ldr *Loader) removeLoadedData(loaderType, tntID, caching string) (err erro
|
||||
if err := ldr.dm.RemoveFilter(tntIDStruct.Tenant, tntIDStruct.ID, utils.NonTransactional); err != nil {
|
||||
return err
|
||||
}
|
||||
cacheArgs.FilterIDs = &ids
|
||||
cacheArgs.FilterIDs = ids
|
||||
}
|
||||
case utils.MetaStats:
|
||||
if ldr.dryRun {
|
||||
@@ -714,8 +714,8 @@ func (ldr *Loader) removeLoadedData(loaderType, tntID, caching string) (err erro
|
||||
if err := ldr.dm.RemoveStatQueue(tntIDStruct.Tenant, tntIDStruct.ID, utils.NonTransactional); err != nil {
|
||||
return err
|
||||
}
|
||||
cacheArgs.StatsQueueProfileIDs = &ids
|
||||
cacheArgs.StatsQueueIDs = &ids
|
||||
cacheArgs.StatsQueueProfileIDs = ids
|
||||
cacheArgs.StatsQueueIDs = ids
|
||||
}
|
||||
case utils.MetaThresholds:
|
||||
if ldr.dryRun {
|
||||
@@ -733,8 +733,8 @@ func (ldr *Loader) removeLoadedData(loaderType, tntID, caching string) (err erro
|
||||
if err := ldr.dm.RemoveThreshold(tntIDStruct.Tenant, tntIDStruct.ID, utils.NonTransactional); err != nil {
|
||||
return err
|
||||
}
|
||||
cacheArgs.ThresholdProfileIDs = &ids
|
||||
cacheArgs.ThresholdIDs = &ids
|
||||
cacheArgs.ThresholdProfileIDs = ids
|
||||
cacheArgs.ThresholdIDs = ids
|
||||
}
|
||||
case utils.MetaSuppliers:
|
||||
if ldr.dryRun {
|
||||
@@ -749,7 +749,7 @@ func (ldr *Loader) removeLoadedData(loaderType, tntID, caching string) (err erro
|
||||
tntIDStruct.ID, utils.NonTransactional, true); err != nil {
|
||||
return err
|
||||
}
|
||||
cacheArgs.SupplierProfileIDs = &ids
|
||||
cacheArgs.SupplierProfileIDs = ids
|
||||
}
|
||||
case utils.MetaChargers:
|
||||
if ldr.dryRun {
|
||||
@@ -764,7 +764,7 @@ func (ldr *Loader) removeLoadedData(loaderType, tntID, caching string) (err erro
|
||||
tntIDStruct.ID, utils.NonTransactional, true); err != nil {
|
||||
return err
|
||||
}
|
||||
cacheArgs.ChargerProfileIDs = &ids
|
||||
cacheArgs.ChargerProfileIDs = ids
|
||||
}
|
||||
case utils.MetaDispatchers:
|
||||
if ldr.dryRun {
|
||||
@@ -779,7 +779,7 @@ func (ldr *Loader) removeLoadedData(loaderType, tntID, caching string) (err erro
|
||||
tntIDStruct.ID, utils.NonTransactional, true); err != nil {
|
||||
return err
|
||||
}
|
||||
cacheArgs.DispatcherProfileIDs = &ids
|
||||
cacheArgs.DispatcherProfileIDs = ids
|
||||
}
|
||||
case utils.MetaDispatcherHosts:
|
||||
if ldr.dryRun {
|
||||
@@ -794,7 +794,7 @@ func (ldr *Loader) removeLoadedData(loaderType, tntID, caching string) (err erro
|
||||
tntIDStruct.ID, utils.NonTransactional); err != nil {
|
||||
return err
|
||||
}
|
||||
cacheArgs.DispatcherHostIDs = &ids
|
||||
cacheArgs.DispatcherHostIDs = ids
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -428,28 +428,28 @@ type AttrGetAccounts struct {
|
||||
}
|
||||
|
||||
type ArgsCache struct {
|
||||
DestinationIDs *[]string
|
||||
ReverseDestinationIDs *[]string
|
||||
RatingPlanIDs *[]string
|
||||
RatingProfileIDs *[]string
|
||||
ActionIDs *[]string
|
||||
ActionPlanIDs *[]string
|
||||
AccountActionPlanIDs *[]string
|
||||
ActionTriggerIDs *[]string
|
||||
SharedGroupIDs *[]string
|
||||
ResourceProfileIDs *[]string
|
||||
ResourceIDs *[]string
|
||||
StatsQueueIDs *[]string
|
||||
StatsQueueProfileIDs *[]string
|
||||
ThresholdIDs *[]string
|
||||
ThresholdProfileIDs *[]string
|
||||
FilterIDs *[]string
|
||||
SupplierProfileIDs *[]string
|
||||
AttributeProfileIDs *[]string
|
||||
ChargerProfileIDs *[]string
|
||||
DispatcherProfileIDs *[]string
|
||||
DispatcherHostIDs *[]string
|
||||
DispatcherRoutesIDs *[]string
|
||||
DestinationIDs []string
|
||||
ReverseDestinationIDs []string
|
||||
RatingPlanIDs []string
|
||||
RatingProfileIDs []string
|
||||
ActionIDs []string
|
||||
ActionPlanIDs []string
|
||||
AccountActionPlanIDs []string
|
||||
ActionTriggerIDs []string
|
||||
SharedGroupIDs []string
|
||||
ResourceProfileIDs []string
|
||||
ResourceIDs []string
|
||||
StatsQueueIDs []string
|
||||
StatsQueueProfileIDs []string
|
||||
ThresholdIDs []string
|
||||
ThresholdProfileIDs []string
|
||||
FilterIDs []string
|
||||
SupplierProfileIDs []string
|
||||
AttributeProfileIDs []string
|
||||
ChargerProfileIDs []string
|
||||
DispatcherProfileIDs []string
|
||||
DispatcherHostIDs []string
|
||||
DispatcherRoutesIDs []string
|
||||
}
|
||||
|
||||
// Data used to do remote cache reloads via api
|
||||
@@ -458,35 +458,30 @@ type AttrReloadCache struct {
|
||||
FlushAll bool // If provided, cache flush will be executed before any action
|
||||
}
|
||||
|
||||
type ArgsCacheKeys struct {
|
||||
ArgsCache
|
||||
Paginator
|
||||
}
|
||||
|
||||
// InitAttrReloadCache initialize AttrReloadCache with empty string slice
|
||||
func InitAttrReloadCache() (rpl AttrReloadCache) {
|
||||
rpl.DestinationIDs = &[]string{}
|
||||
rpl.ReverseDestinationIDs = &[]string{}
|
||||
rpl.RatingPlanIDs = &[]string{}
|
||||
rpl.RatingProfileIDs = &[]string{}
|
||||
rpl.ActionIDs = &[]string{}
|
||||
rpl.ActionPlanIDs = &[]string{}
|
||||
rpl.AccountActionPlanIDs = &[]string{}
|
||||
rpl.ActionTriggerIDs = &[]string{}
|
||||
rpl.SharedGroupIDs = &[]string{}
|
||||
rpl.ResourceProfileIDs = &[]string{}
|
||||
rpl.ResourceIDs = &[]string{}
|
||||
rpl.StatsQueueIDs = &[]string{}
|
||||
rpl.StatsQueueProfileIDs = &[]string{}
|
||||
rpl.ThresholdIDs = &[]string{}
|
||||
rpl.ThresholdProfileIDs = &[]string{}
|
||||
rpl.FilterIDs = &[]string{}
|
||||
rpl.SupplierProfileIDs = &[]string{}
|
||||
rpl.AttributeProfileIDs = &[]string{}
|
||||
rpl.ChargerProfileIDs = &[]string{}
|
||||
rpl.DispatcherProfileIDs = &[]string{}
|
||||
rpl.DispatcherHostIDs = &[]string{}
|
||||
rpl.DispatcherRoutesIDs = &[]string{}
|
||||
rpl.DestinationIDs = []string{}
|
||||
rpl.ReverseDestinationIDs = []string{}
|
||||
rpl.RatingPlanIDs = []string{}
|
||||
rpl.RatingProfileIDs = []string{}
|
||||
rpl.ActionIDs = []string{}
|
||||
rpl.ActionPlanIDs = []string{}
|
||||
rpl.AccountActionPlanIDs = []string{}
|
||||
rpl.ActionTriggerIDs = []string{}
|
||||
rpl.SharedGroupIDs = []string{}
|
||||
rpl.ResourceProfileIDs = []string{}
|
||||
rpl.ResourceIDs = []string{}
|
||||
rpl.StatsQueueIDs = []string{}
|
||||
rpl.StatsQueueProfileIDs = []string{}
|
||||
rpl.ThresholdIDs = []string{}
|
||||
rpl.ThresholdProfileIDs = []string{}
|
||||
rpl.FilterIDs = []string{}
|
||||
rpl.SupplierProfileIDs = []string{}
|
||||
rpl.AttributeProfileIDs = []string{}
|
||||
rpl.ChargerProfileIDs = []string{}
|
||||
rpl.DispatcherProfileIDs = []string{}
|
||||
rpl.DispatcherHostIDs = []string{}
|
||||
rpl.DispatcherRoutesIDs = []string{}
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -976,28 +976,28 @@ func TestAppendToSMCostFilter(t *testing.T) {
|
||||
|
||||
func TestInitAttrReloadCache(t *testing.T) {
|
||||
var expected AttrReloadCache
|
||||
expected.DestinationIDs = &[]string{}
|
||||
expected.ReverseDestinationIDs = &[]string{}
|
||||
expected.RatingPlanIDs = &[]string{}
|
||||
expected.RatingProfileIDs = &[]string{}
|
||||
expected.ActionIDs = &[]string{}
|
||||
expected.ActionPlanIDs = &[]string{}
|
||||
expected.AccountActionPlanIDs = &[]string{}
|
||||
expected.ActionTriggerIDs = &[]string{}
|
||||
expected.SharedGroupIDs = &[]string{}
|
||||
expected.ResourceProfileIDs = &[]string{}
|
||||
expected.ResourceIDs = &[]string{}
|
||||
expected.StatsQueueIDs = &[]string{}
|
||||
expected.StatsQueueProfileIDs = &[]string{}
|
||||
expected.ThresholdIDs = &[]string{}
|
||||
expected.ThresholdProfileIDs = &[]string{}
|
||||
expected.FilterIDs = &[]string{}
|
||||
expected.SupplierProfileIDs = &[]string{}
|
||||
expected.AttributeProfileIDs = &[]string{}
|
||||
expected.ChargerProfileIDs = &[]string{}
|
||||
expected.DispatcherProfileIDs = &[]string{}
|
||||
expected.DispatcherHostIDs = &[]string{}
|
||||
expected.DispatcherRoutesIDs = &[]string{}
|
||||
expected.DestinationIDs = []string{}
|
||||
expected.ReverseDestinationIDs = []string{}
|
||||
expected.RatingPlanIDs = []string{}
|
||||
expected.RatingProfileIDs = []string{}
|
||||
expected.ActionIDs = []string{}
|
||||
expected.ActionPlanIDs = []string{}
|
||||
expected.AccountActionPlanIDs = []string{}
|
||||
expected.ActionTriggerIDs = []string{}
|
||||
expected.SharedGroupIDs = []string{}
|
||||
expected.ResourceProfileIDs = []string{}
|
||||
expected.ResourceIDs = []string{}
|
||||
expected.StatsQueueIDs = []string{}
|
||||
expected.StatsQueueProfileIDs = []string{}
|
||||
expected.ThresholdIDs = []string{}
|
||||
expected.ThresholdProfileIDs = []string{}
|
||||
expected.FilterIDs = []string{}
|
||||
expected.SupplierProfileIDs = []string{}
|
||||
expected.AttributeProfileIDs = []string{}
|
||||
expected.ChargerProfileIDs = []string{}
|
||||
expected.DispatcherProfileIDs = []string{}
|
||||
expected.DispatcherHostIDs = []string{}
|
||||
expected.DispatcherRoutesIDs = []string{}
|
||||
|
||||
if rcv := InitAttrReloadCache(); !reflect.DeepEqual(rcv, expected) {
|
||||
t.Errorf("Expecting: %+v, received: %+v", expected, rcv)
|
||||
|
||||
Reference in New Issue
Block a user