mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-21 15:18:44 +05:00
Updated CacheSv1LoadCache arguments
This commit is contained in:
committed by
Dan Christian Bogos
parent
89f85341a2
commit
4888034ea3
@@ -137,7 +137,7 @@ func (apierSv1 *APIerSv1) RemoveActionTiming(attrs *AttrRemoveActionTiming, repl
|
||||
}
|
||||
if err := apierSv1.ConnMgr.Call(apierSv1.Config.ApierCfg().CachesConns, nil,
|
||||
utils.CacheSv1ReloadCache, utils.AttrReloadCacheWithOpts{
|
||||
ArgsCache: utils.ArgsCache{ActionPlanIDs: []string{attrs.ActionPlanId}},
|
||||
ArgsCache: map[string][]string{utils.ActionPlanIDs: []string{attrs.ActionPlanId}},
|
||||
}, reply); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
@@ -149,7 +149,7 @@ func (apierSv1 *APIerSv1) RemoveActionTiming(attrs *AttrRemoveActionTiming, repl
|
||||
if len(remAcntAPids) != 0 {
|
||||
if err := apierSv1.ConnMgr.Call(apierSv1.Config.ApierCfg().CachesConns, nil,
|
||||
utils.CacheSv1ReloadCache, utils.AttrReloadCacheWithOpts{
|
||||
ArgsCache: utils.ArgsCache{AccountActionPlanIDs: remAcntAPids},
|
||||
ArgsCache: map[string][]string{utils.AccountActionPlanIDs: remAcntAPids},
|
||||
}, reply); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
@@ -247,7 +247,7 @@ func (apierSv1 *APIerSv1) SetAccount(attr *utils.AttrSetAccount, reply *string)
|
||||
}
|
||||
if err := apierSv1.ConnMgr.Call(apierSv1.Config.ApierCfg().CachesConns, nil,
|
||||
utils.CacheSv1ReloadCache, utils.AttrReloadCacheWithOpts{
|
||||
ArgsCache: utils.ArgsCache{AccountActionPlanIDs: []string{accID}, ActionPlanIDs: apIDs},
|
||||
ArgsCache: map[string][]string{utils.AccountActionPlanIDs: []string{accID}, utils.ActionPlanIDs: apIDs},
|
||||
}, reply); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
@@ -343,7 +343,7 @@ func (apierSv1 *APIerSv1) RemoveAccount(attr *utils.AttrRemoveAccount, reply *st
|
||||
}
|
||||
if err = apierSv1.ConnMgr.Call(apierSv1.Config.ApierCfg().CachesConns, nil,
|
||||
utils.CacheSv1ReloadCache, utils.AttrReloadCacheWithOpts{
|
||||
ArgsCache: utils.ArgsCache{AccountActionPlanIDs: []string{accID}},
|
||||
ArgsCache: map[string][]string{utils.AccountActionPlanIDs: []string{accID}},
|
||||
}, reply); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -156,8 +156,8 @@ func (apierSv1 *APIerSv1) SetDestination(attrs *utils.AttrSetDestination, reply
|
||||
}
|
||||
if err := apierSv1.ConnMgr.Call(apierSv1.Config.ApierCfg().CachesConns, nil,
|
||||
utils.CacheSv1ReloadCache, utils.AttrReloadCacheWithOpts{
|
||||
ArgsCache: utils.ArgsCache{ReverseDestinationIDs: dest.Prefixes,
|
||||
DestinationIDs: []string{attrs.Id}},
|
||||
ArgsCache: map[string][]string{utils.ReverseDestinationIDs: dest.Prefixes,
|
||||
utils.DestinationIDs: []string{attrs.Id}},
|
||||
}, reply); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -232,7 +232,7 @@ func (apierSv1 *APIerSv1) LoadDestination(attrs *AttrLoadDestination, reply *str
|
||||
}
|
||||
if err := apierSv1.ConnMgr.Call(apierSv1.Config.ApierCfg().CachesConns, nil,
|
||||
utils.CacheSv1ReloadCache, utils.AttrReloadCacheWithOpts{
|
||||
ArgsCache: utils.ArgsCache{DestinationIDs: []string{attrs.ID}},
|
||||
ArgsCache: map[string][]string{utils.DestinationIDs: []string{attrs.ID}},
|
||||
}, reply); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -725,7 +725,7 @@ func (apierSv1 *APIerSv1) SetActionPlan(attrs *AttrSetActionPlan, reply *string)
|
||||
}
|
||||
if err := apierSv1.ConnMgr.Call(apierSv1.Config.ApierCfg().CachesConns, nil,
|
||||
utils.CacheSv1ReloadCache, utils.AttrReloadCacheWithOpts{
|
||||
ArgsCache: utils.ArgsCache{ActionPlanIDs: []string{ap.Id}},
|
||||
ArgsCache: map[string][]string{utils.ActionPlanIDs: []string{ap.Id}},
|
||||
}, reply); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
@@ -738,7 +738,7 @@ func (apierSv1 *APIerSv1) SetActionPlan(attrs *AttrSetActionPlan, reply *string)
|
||||
sl := prevAccountIDs.Slice()
|
||||
if err := apierSv1.ConnMgr.Call(apierSv1.Config.ApierCfg().CachesConns, nil,
|
||||
utils.CacheSv1ReloadCache, utils.AttrReloadCacheWithOpts{
|
||||
ArgsCache: utils.ArgsCache{AccountActionPlanIDs: sl},
|
||||
ArgsCache: map[string][]string{utils.AccountActionPlanIDs: sl},
|
||||
}, reply); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
@@ -924,7 +924,7 @@ func (apierSv1 *APIerSv1) RemoveActionPlan(attr *AttrGetActionPlan, reply *strin
|
||||
sl := prevAccountIDs.Slice()
|
||||
if err := apierSv1.ConnMgr.Call(apierSv1.Config.ApierCfg().CachesConns, nil,
|
||||
utils.CacheSv1ReloadCache, utils.AttrReloadCacheWithOpts{
|
||||
ArgsCache: utils.ArgsCache{AccountActionPlanIDs: sl},
|
||||
ArgsCache: map[string][]string{utils.AccountActionPlanIDs: sl},
|
||||
}, reply); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
@@ -821,7 +821,7 @@ func testApierLoadAccountActions(t *testing.T) {
|
||||
expectedStats[utils.CacheAccountActionPlans].Items = 1
|
||||
expectedStats[utils.CacheActionPlans].Items = 1
|
||||
expectedStats[utils.CacheActions].Items = 1
|
||||
expectedStats[utils.CacheLoadIDs].Items = 21
|
||||
expectedStats[utils.CacheLoadIDs].Items = 2
|
||||
expectedStats[utils.CacheRPCConnections].Items = 1
|
||||
if err := rater.Call(utils.CacheSv1GetCacheStats, new(utils.AttrCacheIDsWithOpts), &rcvStats); err != nil {
|
||||
t.Error("Got error on CacheSv1.GetCacheStats: ", err.Error())
|
||||
@@ -859,7 +859,7 @@ func testApierSetRatingProfile(t *testing.T) {
|
||||
expectedStats[utils.CacheActions].Items = 1
|
||||
expectedStats[utils.CacheRatingProfiles].Items = 1
|
||||
expectedStats[utils.CacheRPCConnections].Items = 1
|
||||
expectedStats[utils.CacheLoadIDs].Items = 21
|
||||
expectedStats[utils.CacheLoadIDs].Items = 2
|
||||
if err := rater.Call(utils.CacheSv1GetCacheStats, new(utils.AttrCacheIDsWithOpts), &rcvStats); err != nil {
|
||||
t.Error("Got error on CacheSv1.GetCacheStats: ", err.Error())
|
||||
} else if !reflect.DeepEqual(expectedStats, rcvStats) {
|
||||
@@ -951,7 +951,7 @@ func testAPIerSv1GetRatingProfile(t *testing.T) {
|
||||
// Test here ReloadCache
|
||||
func testApierReloadCache(t *testing.T) {
|
||||
var reply string
|
||||
arc := new(utils.ArgsCache)
|
||||
arc := new(utils.AttrReloadCacheWithOpts)
|
||||
// Simple test that command is executed without errors
|
||||
if err := rater.Call(utils.CacheSv1ReloadCache, arc, &reply); err != nil {
|
||||
t.Error("Got error on CacheSv1.ReloadCache: ", err.Error())
|
||||
@@ -966,7 +966,7 @@ func testApierReloadCache(t *testing.T) {
|
||||
expectedStats[utils.CacheRatingProfiles].Items = 2
|
||||
expectedStats[utils.CacheRatingPlans].Items = 1
|
||||
expectedStats[utils.CacheReverseDestinations].Items = 10
|
||||
expectedStats[utils.CacheLoadIDs].Items = 21
|
||||
expectedStats[utils.CacheLoadIDs].Items = 2
|
||||
expectedStats[utils.CacheRPCConnections].Items = 1
|
||||
if err := rater.Call(utils.CacheSv1GetCacheStats, new(utils.AttrCacheIDsWithOpts), &rcvStats); err != nil {
|
||||
t.Error("Got error on CacheSv1.GetCacheStats: ", err.Error())
|
||||
@@ -1476,7 +1476,7 @@ func testApierResetDataAfterLoadFromFolder(t *testing.T) {
|
||||
}
|
||||
var reply string
|
||||
// Simple test that command is executed without errors
|
||||
if err := rater.Call(utils.CacheSv1LoadCache, &utils.ArgsCache{}, &reply); err != nil {
|
||||
if err := rater.Call(utils.CacheSv1LoadCache, utils.NewAttrReloadCacheWithOpts(), &reply); err != nil {
|
||||
t.Error(err)
|
||||
} else if reply != utils.OK {
|
||||
t.Error(reply)
|
||||
@@ -1495,7 +1495,7 @@ func testApierResetDataAfterLoadFromFolder(t *testing.T) {
|
||||
expStats[utils.CacheRouteProfiles].Items = 2
|
||||
expStats[utils.CacheThresholdProfiles].Items = 1
|
||||
expStats[utils.CacheThresholds].Items = 1
|
||||
expStats[utils.CacheLoadIDs].Items = 21
|
||||
expStats[utils.CacheLoadIDs].Items = 22
|
||||
|
||||
if err := rater.Call(utils.CacheSv1GetCacheStats, new(utils.AttrCacheIDsWithOpts), &rcvStats); err != nil {
|
||||
t.Error(err)
|
||||
|
||||
@@ -141,7 +141,7 @@ func testCacheSAfterLoadFromFolder(t *testing.T) {
|
||||
}
|
||||
reply := ""
|
||||
// Simple test that command is executed without errors
|
||||
if err := chcRPC.Call(utils.CacheSv1LoadCache, &utils.ArgsCache{}, &reply); err != nil {
|
||||
if err := chcRPC.Call(utils.CacheSv1LoadCache, utils.NewAttrReloadCacheWithOpts(), &reply); err != nil {
|
||||
t.Error(err)
|
||||
} else if reply != utils.OK {
|
||||
t.Error(reply)
|
||||
@@ -160,7 +160,7 @@ func testCacheSAfterLoadFromFolder(t *testing.T) {
|
||||
expStats[utils.CacheRouteProfiles].Items = 2
|
||||
expStats[utils.CacheThresholdProfiles].Items = 1
|
||||
expStats[utils.CacheThresholds].Items = 1
|
||||
expStats[utils.CacheLoadIDs].Items = 21
|
||||
expStats[utils.CacheLoadIDs].Items = 22
|
||||
|
||||
if err := chcRPC.Call(utils.CacheSv1GetCacheStats, &utils.AttrCacheIDsWithOpts{}, &rcvStats); err != nil {
|
||||
t.Error(err)
|
||||
@@ -192,7 +192,7 @@ func testCacheSReload(t *testing.T) {
|
||||
expStats := engine.GetDefaultEmptyCacheStats()
|
||||
reply := ""
|
||||
// Simple test that command is executed without errors
|
||||
if err := chcRPC.Call(utils.CacheSv1LoadCache, &utils.ArgsCache{}, &reply); err != nil {
|
||||
if err := chcRPC.Call(utils.CacheSv1LoadCache, utils.NewAttrReloadCacheWithOpts(), &reply); err != nil {
|
||||
t.Error(err)
|
||||
} else if reply != utils.OK {
|
||||
t.Error(reply)
|
||||
@@ -215,7 +215,7 @@ func testCacheSReload(t *testing.T) {
|
||||
expStats[utils.CacheRouteProfiles].Items = 2
|
||||
expStats[utils.CacheThresholdProfiles].Items = 1
|
||||
expStats[utils.CacheThresholds].Items = 1
|
||||
expStats[utils.CacheLoadIDs].Items = 21
|
||||
expStats[utils.CacheLoadIDs].Items = 22
|
||||
|
||||
if err := chcRPC.Call(utils.CacheSv1GetCacheStats, &utils.AttrCacheIDsWithOpts{}, &rcvStats); err != nil {
|
||||
t.Error(err)
|
||||
@@ -296,9 +296,8 @@ func testCacheSGetItemExpiryTime(t *testing.T) {
|
||||
}
|
||||
|
||||
func testCacheSReloadCache(t *testing.T) {
|
||||
reply := ""
|
||||
arc := new(utils.ArgsCache)
|
||||
if err := chcRPC.Call(utils.CacheSv1ReloadCache, arc, &reply); err != nil {
|
||||
var reply string
|
||||
if err := chcRPC.Call(utils.CacheSv1ReloadCache, new(utils.AttrReloadCacheWithOpts), &reply); err != nil {
|
||||
t.Error("Got error on CacheSv1.ReloadCache: ", err.Error())
|
||||
} else if reply != utils.OK {
|
||||
t.Error("Calling CacheSv1.ReloadCache got reply: ", reply)
|
||||
|
||||
@@ -36,60 +36,60 @@ func GetCacheOpt(apiOpt *string) string {
|
||||
|
||||
// composeArgsReload add the ItemID to AttrReloadCache
|
||||
// for a specific CacheID
|
||||
func composeArgsReload(args utils.ArgsGetCacheItem) (rpl utils.ArgsCache) {
|
||||
func composeArgsReload(args utils.ArgsGetCacheItem) (rpl map[string][]string) {
|
||||
// ToDo: make the load cache API compatible with gob encoding
|
||||
rpl = utils.ArgsCache{ // in case of load cache we check if the ids are nil so populate them here for the moment
|
||||
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{},
|
||||
RouteProfileIDs: []string{},
|
||||
AttributeProfileIDs: []string{},
|
||||
ChargerProfileIDs: []string{},
|
||||
DispatcherProfileIDs: []string{},
|
||||
DispatcherHostIDs: []string{},
|
||||
DispatcherRoutesIDs: []string{},
|
||||
RateProfileIDs: []string{},
|
||||
rpl = map[string][]string{ // in case of load cache we check if the ids are nil so populate them here for the moment
|
||||
utils.DestinationIDs: {},
|
||||
utils.ReverseDestinationIDs: {},
|
||||
utils.RatingPlanIDs: {},
|
||||
utils.RatingProfileIDs: {},
|
||||
utils.ActionIDs: {},
|
||||
utils.ActionPlanIDs: {},
|
||||
utils.AccountActionPlanIDs: {},
|
||||
utils.ActionTriggerIDs: {},
|
||||
utils.SharedGroupIDs: {},
|
||||
utils.ResourceProfileIDs: {},
|
||||
utils.ResourceIDs: {},
|
||||
utils.StatsQueueIDs: {},
|
||||
utils.StatsQueueProfileIDs: {},
|
||||
utils.ThresholdIDs: {},
|
||||
utils.ThresholdProfileIDs: {},
|
||||
utils.FilterIDs: {},
|
||||
utils.RouteProfileIDs: {},
|
||||
utils.AttributeProfileIDs: {},
|
||||
utils.ChargerProfileIDs: {},
|
||||
utils.DispatcherProfileIDs: {},
|
||||
utils.DispatcherHostIDs: {},
|
||||
utils.DispatcherRoutesIDs: {},
|
||||
utils.RateProfileIDs: {},
|
||||
}
|
||||
switch args.CacheID {
|
||||
case utils.CacheResourceProfiles:
|
||||
rpl.ResourceProfileIDs = []string{args.ItemID}
|
||||
rpl[utils.ResourceProfileIDs] = []string{args.ItemID}
|
||||
case utils.CacheResources:
|
||||
rpl.ResourceIDs = []string{args.ItemID}
|
||||
rpl[utils.ResourceIDs] = []string{args.ItemID}
|
||||
case utils.CacheStatQueues:
|
||||
rpl.StatsQueueIDs = []string{args.ItemID}
|
||||
rpl[utils.StatsQueueIDs] = []string{args.ItemID}
|
||||
case utils.CacheStatQueueProfiles:
|
||||
rpl.StatsQueueProfileIDs = []string{args.ItemID}
|
||||
rpl[utils.StatsQueueProfileIDs] = []string{args.ItemID}
|
||||
case utils.CacheThresholds:
|
||||
rpl.ThresholdIDs = []string{args.ItemID}
|
||||
rpl[utils.ThresholdIDs] = []string{args.ItemID}
|
||||
case utils.CacheThresholdProfiles:
|
||||
rpl.ThresholdProfileIDs = []string{args.ItemID}
|
||||
rpl[utils.ThresholdProfileIDs] = []string{args.ItemID}
|
||||
case utils.CacheFilters:
|
||||
rpl.FilterIDs = []string{args.ItemID}
|
||||
rpl[utils.FilterIDs] = []string{args.ItemID}
|
||||
case utils.CacheRouteProfiles:
|
||||
rpl.RouteProfileIDs = []string{args.ItemID}
|
||||
rpl[utils.RouteProfileIDs] = []string{args.ItemID}
|
||||
case utils.CacheAttributeProfiles:
|
||||
rpl.AttributeProfileIDs = []string{args.ItemID}
|
||||
rpl[utils.AttributeProfileIDs] = []string{args.ItemID}
|
||||
case utils.CacheChargerProfiles:
|
||||
rpl.ChargerProfileIDs = []string{args.ItemID}
|
||||
rpl[utils.ChargerProfileIDs] = []string{args.ItemID}
|
||||
case utils.CacheDispatcherProfiles:
|
||||
rpl.DispatcherProfileIDs = []string{args.ItemID}
|
||||
rpl[utils.DispatcherProfileIDs] = []string{args.ItemID}
|
||||
case utils.CacheDispatcherHosts:
|
||||
rpl.DispatcherHostIDs = []string{args.ItemID}
|
||||
rpl[utils.DispatcherHostIDs] = []string{args.ItemID}
|
||||
case utils.CacheRateProfiles:
|
||||
rpl.RateProfileIDs = []string{args.ItemID}
|
||||
rpl[utils.RateProfileIDs] = []string{args.ItemID}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@@ -209,7 +209,7 @@ func (apiv2 *APIerSv2) SetAccount(attr *AttrSetAccount, reply *string) error {
|
||||
}
|
||||
return 0, apiv2.ConnMgr.Call(apiv2.Config.ApierCfg().CachesConns, nil,
|
||||
utils.CacheSv1ReloadCache, utils.AttrReloadCacheWithOpts{
|
||||
ArgsCache: utils.ArgsCache{AccountActionPlanIDs: []string{accID}, ActionPlanIDs: apIDs},
|
||||
ArgsCache: map[string][]string{utils.AccountActionPlanIDs: {accID}, utils.ActionPlanIDs: apIDs},
|
||||
}, reply)
|
||||
}, config.CgrConfig().GeneralCfg().LockingTimeout, utils.ACTION_PLAN_PREFIX)
|
||||
if err != nil {
|
||||
|
||||
@@ -85,8 +85,7 @@ func durInternalRater(cd *engine.CallDescriptorWithOpts) (time.Duration, error)
|
||||
dm := engine.NewDataManager(dbConn, cgrConfig.CacheCfg(), nil) // for the momentn we use here "" for sentinelName
|
||||
defer dm.DataDB().Close()
|
||||
engine.SetDataStorage(dm)
|
||||
if err := dm.LoadDataDBCache(nil, nil, nil, nil, nil, nil, nil, nil,
|
||||
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil); err != nil {
|
||||
if err := dm.LoadDataDBCache(engine.GetDefaultEmptyArgCachePrefix()); err != nil {
|
||||
return nilDuration, fmt.Errorf("Cache rating error: %s", err.Error())
|
||||
}
|
||||
log.Printf("Runnning %d cycles...", *runs)
|
||||
|
||||
@@ -125,6 +125,7 @@ func testDspChcLoadAfterFolder(t *testing.T) {
|
||||
TenantArg: utils.TenantArg{
|
||||
Tenant: "cgrates.org",
|
||||
},
|
||||
ArgsCache: utils.NewAttrReloadCacheWithOpts().ArgsCache,
|
||||
}, &reply); err != nil {
|
||||
t.Error(err)
|
||||
} else if reply != utils.OK {
|
||||
@@ -144,7 +145,7 @@ func testDspChcLoadAfterFolder(t *testing.T) {
|
||||
expStats[utils.CacheRouteProfiles].Items = 3
|
||||
expStats[utils.CacheThresholdProfiles].Items = 2
|
||||
expStats[utils.CacheThresholds].Items = 2
|
||||
expStats[utils.CacheLoadIDs].Items = 21
|
||||
expStats[utils.CacheLoadIDs].Items = 22
|
||||
if err := dispEngine.RPC.Call(utils.CacheSv1GetCacheStats, &args, &rcvStats); err != nil {
|
||||
t.Error(err)
|
||||
} else if !reflect.DeepEqual(expStats, rcvStats) {
|
||||
|
||||
244
engine/caches.go
244
engine/caches.go
@@ -327,144 +327,14 @@ func (chS *CacheS) V1RemoveGroup(args *utils.ArgsGetGroupWithOpts,
|
||||
return
|
||||
}
|
||||
|
||||
func (chS *CacheS) reloadCache(chID string, IDs []string) error {
|
||||
return chS.dm.CacheDataFromDB(chID, IDs, true)
|
||||
}
|
||||
|
||||
func (chS *CacheS) V1ReloadCache(attrs utils.AttrReloadCacheWithOpts, reply *string) (err error) {
|
||||
if len(attrs.DestinationIDs) != 0 {
|
||||
// Reload Destinations
|
||||
if err = chS.reloadCache(utils.DESTINATION_PREFIX, attrs.DestinationIDs); err != nil {
|
||||
return
|
||||
for key, ids := range attrs.ArgsCache {
|
||||
if prfx, has := utils.ArgCacheToPrefix[key]; has && len(ids) != 0 {
|
||||
if err = chS.dm.CacheDataFromDB(prfx, ids, true); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
if len(attrs.ReverseDestinationIDs) != 0 {
|
||||
// Reload ReverseDestinations
|
||||
if err = chS.reloadCache(utils.REVERSE_DESTINATION_PREFIX, attrs.ReverseDestinationIDs); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
if len(attrs.RatingPlanIDs) != 0 {
|
||||
// RatingPlans
|
||||
if err = chS.reloadCache(utils.RATING_PLAN_PREFIX, attrs.RatingPlanIDs); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
if len(attrs.RatingProfileIDs) != 0 {
|
||||
// RatingProfiles
|
||||
if err = chS.reloadCache(utils.RATING_PROFILE_PREFIX, attrs.RatingProfileIDs); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
if len(attrs.ActionIDs) != 0 {
|
||||
// Actions
|
||||
if err = chS.reloadCache(utils.ACTION_PREFIX, attrs.ActionIDs); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
if len(attrs.ActionPlanIDs) != 0 {
|
||||
// ActionPlans
|
||||
if err = chS.reloadCache(utils.ACTION_PLAN_PREFIX, attrs.ActionPlanIDs); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
if len(attrs.AccountActionPlanIDs) != 0 {
|
||||
// AccountActionPlans
|
||||
if err = chS.reloadCache(utils.AccountActionPlansPrefix, attrs.AccountActionPlanIDs); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
if len(attrs.ActionTriggerIDs) != 0 {
|
||||
// ActionTriggers
|
||||
if err = chS.reloadCache(utils.ACTION_TRIGGER_PREFIX, attrs.ActionTriggerIDs); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
if len(attrs.SharedGroupIDs) != 0 {
|
||||
// SharedGroups
|
||||
if err = chS.reloadCache(utils.SHARED_GROUP_PREFIX, attrs.SharedGroupIDs); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
if len(attrs.ResourceProfileIDs) != 0 {
|
||||
// ResourceProfiles
|
||||
if err = chS.reloadCache(utils.ResourceProfilesPrefix, attrs.ResourceProfileIDs); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
if len(attrs.ResourceIDs) != 0 {
|
||||
// Resources
|
||||
if err = chS.reloadCache(utils.ResourcesPrefix, attrs.ResourceIDs); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
if len(attrs.StatsQueueIDs) != 0 {
|
||||
// StatQueues
|
||||
if err = chS.reloadCache(utils.StatQueuePrefix, attrs.StatsQueueIDs); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
if len(attrs.StatsQueueProfileIDs) != 0 {
|
||||
// StatQueueProfiles
|
||||
if err = chS.reloadCache(utils.StatQueueProfilePrefix, attrs.StatsQueueProfileIDs); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
if len(attrs.ThresholdIDs) != 0 {
|
||||
// Thresholds
|
||||
if err = chS.reloadCache(utils.ThresholdPrefix, attrs.ThresholdIDs); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
if len(attrs.ThresholdProfileIDs) != 0 {
|
||||
// ThresholdProfiles
|
||||
if err = chS.reloadCache(utils.ThresholdProfilePrefix, attrs.ThresholdProfileIDs); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
if len(attrs.FilterIDs) != 0 {
|
||||
// Filters
|
||||
if err = chS.reloadCache(utils.FilterPrefix, attrs.FilterIDs); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
if len(attrs.RouteProfileIDs) != 0 {
|
||||
// RouteProfiles
|
||||
if err = chS.reloadCache(utils.RouteProfilePrefix, attrs.RouteProfileIDs); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
if len(attrs.AttributeProfileIDs) != 0 {
|
||||
// AttributeProfile
|
||||
if err = chS.reloadCache(utils.AttributeProfilePrefix, attrs.AttributeProfileIDs); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
if len(attrs.ChargerProfileIDs) != 0 {
|
||||
// ChargerProfiles
|
||||
if err = chS.reloadCache(utils.ChargerProfilePrefix, attrs.ChargerProfileIDs); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
if len(attrs.DispatcherProfileIDs) != 0 {
|
||||
// DispatcherProfile
|
||||
if err = chS.reloadCache(utils.DispatcherProfilePrefix, attrs.DispatcherProfileIDs); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
if len(attrs.DispatcherHostIDs) != 0 {
|
||||
// DispatcherHosts
|
||||
if err = chS.reloadCache(utils.DispatcherHostPrefix, attrs.DispatcherHostIDs); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
if len(attrs.RateProfileIDs) != 0 {
|
||||
// RateProfiles
|
||||
if err = chS.reloadCache(utils.RateProfilePrefix, attrs.RateProfileIDs); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
//get loadIDs from database for all types
|
||||
loadIDs, err := chS.dm.GetItemLoadIDs(utils.EmptyString, false)
|
||||
if err != nil {
|
||||
@@ -484,31 +354,14 @@ func (chS *CacheS) V1ReloadCache(attrs utils.AttrReloadCacheWithOpts, reply *str
|
||||
return nil
|
||||
}
|
||||
|
||||
func (chS *CacheS) V1LoadCache(args utils.AttrReloadCacheWithOpts, reply *string) (err error) {
|
||||
if err := chS.dm.LoadDataDBCache(
|
||||
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.RouteProfileIDs,
|
||||
args.AttributeProfileIDs,
|
||||
args.ChargerProfileIDs,
|
||||
args.DispatcherProfileIDs,
|
||||
args.DispatcherHostIDs,
|
||||
args.RateProfileIDs,
|
||||
); err != nil {
|
||||
func (chS *CacheS) V1LoadCache(attrs utils.AttrReloadCacheWithOpts, reply *string) (err error) {
|
||||
args := make(map[string][]string)
|
||||
for key, ids := range attrs.ArgsCache {
|
||||
if prfx, has := utils.ArgCacheToPrefix[key]; has {
|
||||
args[prfx] = ids
|
||||
}
|
||||
}
|
||||
if err := chS.dm.LoadDataDBCache(args); err != nil {
|
||||
return utils.NewErrServerError(err)
|
||||
}
|
||||
//get loadIDs for all types
|
||||
@@ -520,7 +373,7 @@ func (chS *CacheS) V1LoadCache(args utils.AttrReloadCacheWithOpts, reply *string
|
||||
return err
|
||||
}
|
||||
}
|
||||
cacheLoadIDs := populateCacheLoadIDs(loadIDs, args.ArgsCache)
|
||||
cacheLoadIDs := populateCacheLoadIDs(loadIDs, attrs.ArgsCache)
|
||||
for key, val := range cacheLoadIDs {
|
||||
chS.tCache.Set(utils.CacheLoadIDs, key, val, nil,
|
||||
cacheCommit(utils.NonTransactional), utils.NonTransactional)
|
||||
@@ -530,71 +383,14 @@ func (chS *CacheS) V1LoadCache(args utils.AttrReloadCacheWithOpts, reply *string
|
||||
}
|
||||
|
||||
//populateCacheLoadIDs populate cacheLoadIDs based on attrs
|
||||
func populateCacheLoadIDs(loadIDs map[string]int64, attrs utils.ArgsCache) (cacheLoadIDs map[string]int64) {
|
||||
func populateCacheLoadIDs(loadIDs map[string]int64, attrs map[string][]string) (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 {
|
||||
cacheLoadIDs[utils.CacheDestinations] = loadIDs[utils.CacheDestinations]
|
||||
}
|
||||
if attrs.ReverseDestinationIDs == nil || len(attrs.ReverseDestinationIDs) != 0 {
|
||||
cacheLoadIDs[utils.CacheReverseDestinations] = loadIDs[utils.CacheReverseDestinations]
|
||||
}
|
||||
if attrs.RatingPlanIDs == nil || len(attrs.RatingPlanIDs) != 0 {
|
||||
cacheLoadIDs[utils.CacheRatingPlans] = loadIDs[utils.CacheRatingPlans]
|
||||
}
|
||||
if attrs.RatingProfileIDs == nil || len(attrs.RatingProfileIDs) != 0 {
|
||||
cacheLoadIDs[utils.CacheRatingProfiles] = loadIDs[utils.CacheRatingProfiles]
|
||||
}
|
||||
if attrs.ActionIDs == nil || len(attrs.ActionIDs) != 0 {
|
||||
cacheLoadIDs[utils.CacheActions] = loadIDs[utils.CacheActions]
|
||||
}
|
||||
if attrs.ActionPlanIDs == nil || len(attrs.ActionPlanIDs) != 0 {
|
||||
cacheLoadIDs[utils.CacheActionPlans] = loadIDs[utils.CacheActionPlans]
|
||||
}
|
||||
if attrs.AccountActionPlanIDs == nil || len(attrs.AccountActionPlanIDs) != 0 {
|
||||
cacheLoadIDs[utils.CacheAccountActionPlans] = loadIDs[utils.CacheAccountActionPlans]
|
||||
}
|
||||
if attrs.ActionTriggerIDs == nil || len(attrs.ActionTriggerIDs) != 0 {
|
||||
cacheLoadIDs[utils.CacheActionTriggers] = loadIDs[utils.CacheActionTriggers]
|
||||
}
|
||||
if attrs.SharedGroupIDs == nil || len(attrs.SharedGroupIDs) != 0 {
|
||||
cacheLoadIDs[utils.CacheSharedGroups] = loadIDs[utils.CacheSharedGroups]
|
||||
}
|
||||
if attrs.ResourceProfileIDs == nil || len(attrs.ResourceProfileIDs) != 0 {
|
||||
cacheLoadIDs[utils.CacheResourceProfiles] = loadIDs[utils.CacheResourceProfiles]
|
||||
}
|
||||
if attrs.ResourceIDs == nil || len(attrs.ResourceIDs) != 0 {
|
||||
cacheLoadIDs[utils.CacheResources] = loadIDs[utils.CacheResources]
|
||||
}
|
||||
if attrs.StatsQueueProfileIDs == nil || len(attrs.StatsQueueProfileIDs) != 0 {
|
||||
cacheLoadIDs[utils.CacheStatQueueProfiles] = loadIDs[utils.CacheStatQueueProfiles]
|
||||
}
|
||||
if attrs.StatsQueueIDs == nil || len(attrs.StatsQueueIDs) != 0 {
|
||||
cacheLoadIDs[utils.CacheStatQueues] = loadIDs[utils.CacheStatQueues]
|
||||
}
|
||||
if attrs.ThresholdProfileIDs == nil || len(attrs.ThresholdProfileIDs) != 0 {
|
||||
cacheLoadIDs[utils.CacheThresholdProfiles] = loadIDs[utils.CacheThresholdProfiles]
|
||||
}
|
||||
if attrs.ThresholdIDs == nil || len(attrs.ThresholdIDs) != 0 {
|
||||
cacheLoadIDs[utils.CacheThresholds] = loadIDs[utils.CacheThresholds]
|
||||
}
|
||||
if attrs.FilterIDs == nil || len(attrs.FilterIDs) != 0 {
|
||||
cacheLoadIDs[utils.CacheFilters] = loadIDs[utils.CacheFilters]
|
||||
}
|
||||
if attrs.RouteProfileIDs == nil || len(attrs.RouteProfileIDs) != 0 {
|
||||
cacheLoadIDs[utils.CacheRouteProfiles] = loadIDs[utils.CacheRouteProfiles]
|
||||
}
|
||||
if attrs.AttributeProfileIDs == nil || len(attrs.AttributeProfileIDs) != 0 {
|
||||
cacheLoadIDs[utils.CacheAttributeProfiles] = loadIDs[utils.CacheAttributeProfiles]
|
||||
}
|
||||
if attrs.ChargerProfileIDs == nil || len(attrs.ChargerProfileIDs) != 0 {
|
||||
cacheLoadIDs[utils.CacheChargerProfiles] = loadIDs[utils.CacheChargerProfiles]
|
||||
}
|
||||
if attrs.DispatcherProfileIDs == nil || len(attrs.DispatcherProfileIDs) != 0 {
|
||||
cacheLoadIDs[utils.CacheDispatcherProfiles] = loadIDs[utils.CacheDispatcherProfiles]
|
||||
}
|
||||
if attrs.RateProfileIDs == nil || len(attrs.RateProfileIDs) != 0 {
|
||||
cacheLoadIDs[utils.CacheRateProfiles] = loadIDs[utils.CacheRateProfiles]
|
||||
for key, ids := range attrs {
|
||||
if inst, has := utils.ArgCacheToInstance[key]; has &&
|
||||
(ids == nil || len(ids) != 0) {
|
||||
cacheLoadIDs[inst] = loadIDs[inst]
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@@ -100,9 +100,7 @@ func (dm *DataManager) DataDB() DataDB {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (dm *DataManager) LoadDataDBCache(dstIDs, rvDstIDs, rplIDs, rpfIDs, actIDs, aplIDs,
|
||||
aaPlIDs, atrgIDs, sgIDs, rpIDs, resIDs, stqIDs, stqpIDs, thIDs, thpIDs, fltrIDs,
|
||||
rPrflIDs, alsPrfIDs, cppIDs, dppIDs, dphIDs, ratePrfIDs []string) (err error) {
|
||||
func (dm *DataManager) LoadDataDBCache(attr map[string][]string) (err error) {
|
||||
if dm == nil {
|
||||
err = utils.ErrNoDatabaseConn
|
||||
return
|
||||
@@ -110,30 +108,7 @@ func (dm *DataManager) LoadDataDBCache(dstIDs, rvDstIDs, rplIDs, rpfIDs, actIDs,
|
||||
if dm.DataDB().GetStorageType() == utils.INTERNAL {
|
||||
return // all the data is in cache already
|
||||
}
|
||||
for key, ids := range map[string][]string{
|
||||
utils.DESTINATION_PREFIX: dstIDs,
|
||||
utils.REVERSE_DESTINATION_PREFIX: rvDstIDs,
|
||||
utils.RATING_PLAN_PREFIX: rplIDs,
|
||||
utils.RATING_PROFILE_PREFIX: rpfIDs,
|
||||
utils.ACTION_PREFIX: actIDs,
|
||||
utils.ACTION_PLAN_PREFIX: aplIDs,
|
||||
utils.AccountActionPlansPrefix: aaPlIDs,
|
||||
utils.ACTION_TRIGGER_PREFIX: atrgIDs,
|
||||
utils.SHARED_GROUP_PREFIX: sgIDs,
|
||||
utils.ResourceProfilesPrefix: rpIDs,
|
||||
utils.ResourcesPrefix: resIDs,
|
||||
utils.StatQueuePrefix: stqIDs,
|
||||
utils.StatQueueProfilePrefix: stqpIDs,
|
||||
utils.ThresholdPrefix: thIDs,
|
||||
utils.ThresholdProfilePrefix: thpIDs,
|
||||
utils.FilterPrefix: fltrIDs,
|
||||
utils.RouteProfilePrefix: rPrflIDs,
|
||||
utils.AttributeProfilePrefix: alsPrfIDs,
|
||||
utils.ChargerProfilePrefix: cppIDs,
|
||||
utils.DispatcherProfilePrefix: dppIDs,
|
||||
utils.DispatcherHostPrefix: dphIDs,
|
||||
utils.RateProfilePrefix: ratePrfIDs,
|
||||
} {
|
||||
for key, ids := range attr {
|
||||
if err = dm.CacheDataFromDB(key, ids, false); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -551,3 +551,30 @@ func GetDefaultEmptyCacheStats() map[string]*ltcache.CacheStats {
|
||||
utils.CacheTBLTPRateProfiles: {},
|
||||
}
|
||||
}
|
||||
|
||||
func GetDefaultEmptyArgCachePrefix() map[string][]string {
|
||||
return map[string][]string{
|
||||
utils.DESTINATION_PREFIX: nil,
|
||||
utils.REVERSE_DESTINATION_PREFIX: nil,
|
||||
utils.RATING_PLAN_PREFIX: nil,
|
||||
utils.RATING_PROFILE_PREFIX: nil,
|
||||
utils.ACTION_PREFIX: nil,
|
||||
utils.ACTION_PLAN_PREFIX: nil,
|
||||
utils.AccountActionPlansPrefix: nil,
|
||||
utils.ACTION_TRIGGER_PREFIX: nil,
|
||||
utils.SHARED_GROUP_PREFIX: nil,
|
||||
utils.ResourceProfilesPrefix: nil,
|
||||
utils.ResourcesPrefix: nil,
|
||||
utils.StatQueuePrefix: nil,
|
||||
utils.StatQueueProfilePrefix: nil,
|
||||
utils.ThresholdPrefix: nil,
|
||||
utils.ThresholdProfilePrefix: nil,
|
||||
utils.FilterPrefix: nil,
|
||||
utils.RouteProfilePrefix: nil,
|
||||
utils.AttributeProfilePrefix: nil,
|
||||
utils.ChargerProfilePrefix: nil,
|
||||
utils.DispatcherProfilePrefix: nil,
|
||||
utils.DispatcherHostPrefix: nil,
|
||||
utils.RateProfilePrefix: nil,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ func TestStorageCacheRefresh(t *testing.T) {
|
||||
dm.GetDestination("T11", false, utils.NonTransactional)
|
||||
dm.SetDestination(&Destination{"T11", []string{"1"}}, utils.NonTransactional)
|
||||
t.Log("Test cache refresh")
|
||||
err := dm.LoadDataDBCache(nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil)
|
||||
err := dm.LoadDataDBCache(GetDefaultEmptyArgCachePrefix())
|
||||
if err != nil {
|
||||
t.Error("Error cache rating: ", err)
|
||||
}
|
||||
|
||||
@@ -800,8 +800,10 @@ func (tpr *TpReader) LoadAccountActionsFiltered(qriedAA *utils.TPAccountActions)
|
||||
var reply string
|
||||
if err := connMgr.Call(tpr.cacheConns, nil,
|
||||
utils.CacheSv1ReloadCache, utils.AttrReloadCacheWithOpts{
|
||||
ArgsCache: utils.ArgsCache{AccountActionPlanIDs: []string{id},
|
||||
ActionPlanIDs: []string{accountAction.ActionPlanId}},
|
||||
ArgsCache: map[string][]string{
|
||||
utils.AccountActionPlanIDs: {id},
|
||||
utils.ActionPlanIDs: {accountAction.ActionPlanId},
|
||||
},
|
||||
}, &reply); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -2435,29 +2437,29 @@ func (tpr *TpReader) ReloadCache(caching string, verbose bool, opts map[string]i
|
||||
//compose Reload Cache argument
|
||||
cacheArgs := utils.AttrReloadCacheWithOpts{
|
||||
Opts: opts,
|
||||
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,
|
||||
RouteProfileIDs: routeIDs,
|
||||
AttributeProfileIDs: apfIDs,
|
||||
ChargerProfileIDs: chargerIDs,
|
||||
DispatcherProfileIDs: dppIDs,
|
||||
DispatcherHostIDs: dphIDs,
|
||||
RateProfileIDs: ratePrfIDs,
|
||||
ArgsCache: map[string][]string{
|
||||
utils.DestinationIDs: dstIds,
|
||||
utils.ReverseDestinationIDs: revDstIDs,
|
||||
utils.RatingPlanIDs: rplIds,
|
||||
utils.RatingProfileIDs: rpfIds,
|
||||
utils.ActionIDs: actIds,
|
||||
utils.ActionPlanIDs: aps,
|
||||
utils.AccountActionPlanIDs: aapIDs,
|
||||
utils.SharedGroupIDs: shgIds,
|
||||
utils.ResourceProfileIDs: rspIDs,
|
||||
utils.ResourceIDs: resIDs,
|
||||
utils.ActionTriggerIDs: aatIDs,
|
||||
utils.StatsQueueIDs: stqIDs,
|
||||
utils.StatsQueueProfileIDs: stqpIDs,
|
||||
utils.ThresholdIDs: trsIDs,
|
||||
utils.ThresholdProfileIDs: trspfIDs,
|
||||
utils.FilterIDs: flrIDs,
|
||||
utils.RouteProfileIDs: routeIDs,
|
||||
utils.AttributeProfileIDs: apfIDs,
|
||||
utils.ChargerProfileIDs: chargerIDs,
|
||||
utils.DispatcherProfileIDs: dppIDs,
|
||||
utils.DispatcherHostIDs: dphIDs,
|
||||
utils.RateProfileIDs: ratePrfIDs,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -67,8 +67,7 @@ ENABLE_ACNT,*enable_account,,,,,,,,,,,,,false,false,10`
|
||||
}
|
||||
csvr.WriteToDatabase(false, false)
|
||||
|
||||
dbAcntActs.LoadDataDBCache(nil, nil, nil, nil, nil, nil, nil,
|
||||
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil)
|
||||
dbAcntActs.LoadDataDBCache(engine.GetDefaultEmptyArgCachePrefix())
|
||||
|
||||
expectAcnt := &engine.Account{ID: "cgrates.org:1"}
|
||||
if acnt, err := dbAcntActs.GetAccount("cgrates.org:1"); err != nil {
|
||||
|
||||
@@ -108,8 +108,7 @@ cgrates.org,call,*any,2013-01-06T00:00:00Z,RP_ANY,`
|
||||
t.Error("No account saved")
|
||||
}
|
||||
|
||||
dbAuth.LoadDataDBCache(nil, nil, nil, nil, nil, nil, nil, nil,
|
||||
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil)
|
||||
dbAuth.LoadDataDBCache(engine.GetDefaultEmptyArgCachePrefix())
|
||||
|
||||
if cachedDests := len(engine.Cache.GetItemIDs(utils.CacheDestinations, "")); cachedDests != 1 {
|
||||
t.Error("Wrong number of cached destinations found", cachedDests)
|
||||
|
||||
@@ -83,8 +83,7 @@ cgrates.org,sms,*any,2012-01-01T00:00:00Z,RP_SMS1,`
|
||||
t.Fatal(err)
|
||||
}
|
||||
csvr.WriteToDatabase(false, false)
|
||||
dataDB.LoadDataDBCache(nil, nil, nil, nil, nil, nil, nil, nil,
|
||||
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil)
|
||||
dataDB.LoadDataDBCache(engine.GetDefaultEmptyArgCachePrefix())
|
||||
|
||||
if cachedRPlans := len(engine.Cache.GetItemIDs(utils.CacheRatingPlans, utils.EmptyString)); cachedRPlans != 3 {
|
||||
t.Error("Wrong number of cached rating plans found", cachedRPlans)
|
||||
|
||||
@@ -68,8 +68,7 @@ RP_DATA1,DR_DATA_2,TM2,10`
|
||||
t.Fatal(err)
|
||||
}
|
||||
csvr.WriteToDatabase(false, false)
|
||||
dataDB.LoadDataDBCache(nil, nil, nil, nil, nil, nil, nil, nil,
|
||||
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil)
|
||||
dataDB.LoadDataDBCache(engine.GetDefaultEmptyArgCachePrefix())
|
||||
|
||||
if cachedRPlans := len(engine.Cache.GetItemIDs(utils.CacheRatingPlans, utils.EmptyString)); cachedRPlans != 1 {
|
||||
t.Error("Wrong number of cached rating plans found", cachedRPlans)
|
||||
|
||||
@@ -112,8 +112,7 @@ TOPUP10_AT,TOPUP10_AC1,ASAP,10`
|
||||
t.Error("No account saved")
|
||||
}
|
||||
|
||||
dataDB.LoadDataDBCache(nil, nil, nil, nil, nil, nil, nil, nil,
|
||||
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil)
|
||||
dataDB.LoadDataDBCache(engine.GetDefaultEmptyArgCachePrefix())
|
||||
|
||||
if cachedDests := len(engine.Cache.GetItemIDs(utils.CacheDestinations, "")); cachedDests != 1 {
|
||||
t.Error("Wrong number of cached destinations found", cachedDests)
|
||||
|
||||
@@ -109,8 +109,7 @@ TOPUP10_AT,TOPUP10_AC1,ASAP,10`
|
||||
} else if acnt == nil {
|
||||
t.Error("No account saved")
|
||||
}
|
||||
dataDB2.LoadDataDBCache(nil, nil, nil, nil, nil, nil, nil, nil,
|
||||
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil)
|
||||
dataDB2.LoadDataDBCache(engine.GetDefaultEmptyArgCachePrefix())
|
||||
|
||||
if cachedDests := len(engine.Cache.GetItemIDs(utils.CacheDestinations, "")); cachedDests != 1 {
|
||||
t.Error("Wrong number of cached destinations found", cachedDests)
|
||||
|
||||
@@ -108,8 +108,7 @@ cgrates.org,call,discounted_minutes,2013-01-06T00:00:00Z,RP_UK_Mobile_BIG5_PKG,`
|
||||
} else if acnt == nil {
|
||||
t.Error("No account saved")
|
||||
}
|
||||
dataDB3.LoadDataDBCache(nil, nil, nil, nil, nil, nil, nil, nil,
|
||||
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil)
|
||||
dataDB3.LoadDataDBCache(engine.GetDefaultEmptyArgCachePrefix())
|
||||
|
||||
if cachedDests := len(engine.Cache.GetItemIDs(utils.CacheDestinations, "")); cachedDests != 1 {
|
||||
t.Error("Wrong number of cached destinations found", cachedDests)
|
||||
|
||||
@@ -68,8 +68,7 @@ func TestSMSLoadCsvTpSmsChrg1(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
csvr.WriteToDatabase(false, false)
|
||||
dataDB.LoadDataDBCache(nil, nil, nil, nil, nil, nil, nil, nil,
|
||||
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil)
|
||||
dataDB.LoadDataDBCache(engine.GetDefaultEmptyArgCachePrefix())
|
||||
|
||||
if cachedRPlans := len(engine.Cache.GetItemIDs(utils.CacheRatingPlans, utils.EmptyString)); cachedRPlans != 1 {
|
||||
t.Error("Wrong number of cached rating plans found", cachedRPlans)
|
||||
|
||||
@@ -125,7 +125,7 @@ func testTutSMGLoadTariffPlanFromFolder(t *testing.T) {
|
||||
// Check loaded stats
|
||||
func testTutSMGCacheStats(t *testing.T) {
|
||||
var reply string
|
||||
if err := tutSMGRpc.Call(utils.CacheSv1LoadCache, &utils.ArgsCache{}, &reply); err != nil {
|
||||
if err := tutSMGRpc.Call(utils.CacheSv1LoadCache, utils.NewAttrReloadCacheWithOpts(), &reply); err != nil {
|
||||
t.Error(err)
|
||||
} else if reply != utils.OK {
|
||||
t.Error(reply)
|
||||
@@ -155,7 +155,7 @@ func testTutSMGCacheStats(t *testing.T) {
|
||||
expectedStats[utils.CacheAttributeProfiles].Items = 2
|
||||
expectedStats[utils.MetaDefault].Items = 1
|
||||
expectedStats[utils.CacheActionTriggers].Items = 1
|
||||
expectedStats[utils.CacheLoadIDs].Items = 21
|
||||
expectedStats[utils.CacheLoadIDs].Items = 22
|
||||
expectedStats[utils.CacheChargerProfiles].Items = 1
|
||||
expectedStats[utils.CacheRPCConnections].Items = 2
|
||||
if err := tutSMGRpc.Call(utils.CacheSv1GetCacheStats, new(utils.AttrCacheIDsWithOpts), &rcvStats); err != nil {
|
||||
|
||||
@@ -275,7 +275,7 @@ func (ldr *Loader) processContent(loaderType, caching string) (err error) {
|
||||
func (ldr *Loader) storeLoadedData(loaderType string,
|
||||
lds map[string][]LoaderData, caching string) (err error) {
|
||||
var ids []string
|
||||
var cacheArgs utils.ArgsCache
|
||||
cacheArgs := make(map[string][]string)
|
||||
var cachePartition string
|
||||
switch loaderType {
|
||||
case utils.MetaAttributes:
|
||||
@@ -304,7 +304,7 @@ func (ldr *Loader) storeLoadedData(loaderType string,
|
||||
return err
|
||||
}
|
||||
}
|
||||
cacheArgs.AttributeProfileIDs = ids
|
||||
cacheArgs[utils.AttributeProfileIDs] = ids
|
||||
cachePartition = utils.CacheAttributeProfiles
|
||||
}
|
||||
case utils.MetaResources:
|
||||
@@ -339,8 +339,8 @@ func (ldr *Loader) storeLoadedData(loaderType string,
|
||||
Usages: make(map[string]*engine.ResourceUsage)}); err != nil {
|
||||
return err
|
||||
}
|
||||
cacheArgs.ResourceProfileIDs = ids
|
||||
cacheArgs.ResourceIDs = ids
|
||||
cacheArgs[utils.ResourceProfileIDs] = ids
|
||||
cacheArgs[utils.ResourceIDs] = ids
|
||||
cachePartition = utils.CacheResourceProfiles
|
||||
}
|
||||
}
|
||||
@@ -370,7 +370,7 @@ func (ldr *Loader) storeLoadedData(loaderType string,
|
||||
if err := ldr.dm.SetFilter(fltrPrf, true); err != nil {
|
||||
return err
|
||||
}
|
||||
cacheArgs.FilterIDs = ids
|
||||
cacheArgs[utils.FilterIDs] = ids
|
||||
cachePartition = utils.CacheFilters
|
||||
}
|
||||
}
|
||||
@@ -410,8 +410,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[utils.StatsQueueProfileIDs] = ids
|
||||
cacheArgs[utils.StatsQueueIDs] = ids
|
||||
cachePartition = utils.CacheFilters
|
||||
}
|
||||
}
|
||||
@@ -443,8 +443,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[utils.ThresholdProfileIDs] = ids
|
||||
cacheArgs[utils.ThresholdIDs] = ids
|
||||
cachePartition = utils.CacheThresholdProfiles
|
||||
}
|
||||
}
|
||||
@@ -474,7 +474,7 @@ func (ldr *Loader) storeLoadedData(loaderType string,
|
||||
if err := ldr.dm.SetRouteProfile(spPrf, true); err != nil {
|
||||
return err
|
||||
}
|
||||
cacheArgs.RouteProfileIDs = ids
|
||||
cacheArgs[utils.RouteProfileIDs] = ids
|
||||
cachePartition = utils.CacheRouteProfiles
|
||||
}
|
||||
}
|
||||
@@ -504,7 +504,7 @@ func (ldr *Loader) storeLoadedData(loaderType string,
|
||||
if err := ldr.dm.SetChargerProfile(cpp, true); err != nil {
|
||||
return err
|
||||
}
|
||||
cacheArgs.ChargerProfileIDs = ids
|
||||
cacheArgs[utils.ChargerProfileIDs] = ids
|
||||
cachePartition = utils.CacheChargerProfiles
|
||||
}
|
||||
}
|
||||
@@ -533,7 +533,7 @@ func (ldr *Loader) storeLoadedData(loaderType string,
|
||||
if err := ldr.dm.SetDispatcherProfile(dsp, true); err != nil {
|
||||
return err
|
||||
}
|
||||
cacheArgs.DispatcherProfileIDs = ids
|
||||
cacheArgs[utils.DispatcherProfileIDs] = ids
|
||||
cachePartition = utils.CacheDispatcherProfiles
|
||||
}
|
||||
}
|
||||
@@ -559,7 +559,7 @@ func (ldr *Loader) storeLoadedData(loaderType string,
|
||||
if err := ldr.dm.SetDispatcherHost(dsp); err != nil {
|
||||
return err
|
||||
}
|
||||
cacheArgs.DispatcherHostIDs = ids
|
||||
cacheArgs[utils.DispatcherHostIDs] = ids
|
||||
cachePartition = utils.CacheDispatcherHosts
|
||||
}
|
||||
}
|
||||
@@ -594,7 +594,7 @@ func (ldr *Loader) storeLoadedData(loaderType string,
|
||||
return err
|
||||
}
|
||||
}
|
||||
cacheArgs.RateProfileIDs = ids
|
||||
cacheArgs[utils.RateProfileIDs] = ids
|
||||
cachePartition = utils.CacheRateProfiles
|
||||
}
|
||||
}
|
||||
@@ -710,7 +710,7 @@ func (ldr *Loader) removeContent(loaderType, caching string) (err error) {
|
||||
//since we remove we don't need to compose the struct we only need the Tenant and the ID of the profile
|
||||
func (ldr *Loader) removeLoadedData(loaderType string, lds map[string][]LoaderData, caching string) (err error) {
|
||||
var ids []string
|
||||
var cacheArgs utils.ArgsCache
|
||||
cacheArgs := make(map[string][]string)
|
||||
var cachePartition string
|
||||
switch loaderType {
|
||||
case utils.MetaAttributes:
|
||||
@@ -727,7 +727,7 @@ func (ldr *Loader) removeLoadedData(loaderType string, lds map[string][]LoaderDa
|
||||
utils.NonTransactional, true); err != nil {
|
||||
return err
|
||||
}
|
||||
cacheArgs.AttributeProfileIDs = ids
|
||||
cacheArgs[utils.AttributeProfileIDs] = ids
|
||||
cachePartition = utils.CacheAttributeProfiles
|
||||
}
|
||||
}
|
||||
@@ -750,8 +750,8 @@ func (ldr *Loader) removeLoadedData(loaderType string, lds map[string][]LoaderDa
|
||||
if err := ldr.dm.RemoveResource(tntIDStruct.Tenant, tntIDStruct.ID, utils.NonTransactional); err != nil {
|
||||
return err
|
||||
}
|
||||
cacheArgs.ResourceProfileIDs = ids
|
||||
cacheArgs.ResourceIDs = ids
|
||||
cacheArgs[utils.ResourceProfileIDs] = ids
|
||||
cacheArgs[utils.ResourceIDs] = ids
|
||||
cachePartition = utils.CacheResourceProfiles
|
||||
}
|
||||
}
|
||||
@@ -769,7 +769,7 @@ func (ldr *Loader) removeLoadedData(loaderType string, lds map[string][]LoaderDa
|
||||
utils.NonTransactional, true); err != nil {
|
||||
return err
|
||||
}
|
||||
cacheArgs.FilterIDs = ids
|
||||
cacheArgs[utils.FilterIDs] = ids
|
||||
cachePartition = utils.CacheFilters
|
||||
}
|
||||
}
|
||||
@@ -790,8 +790,8 @@ func (ldr *Loader) removeLoadedData(loaderType string, lds map[string][]LoaderDa
|
||||
if err := ldr.dm.RemoveStatQueue(tntIDStruct.Tenant, tntIDStruct.ID, utils.NonTransactional); err != nil {
|
||||
return err
|
||||
}
|
||||
cacheArgs.StatsQueueProfileIDs = ids
|
||||
cacheArgs.StatsQueueIDs = ids
|
||||
cacheArgs[utils.StatsQueueProfileIDs] = ids
|
||||
cacheArgs[utils.StatsQueueIDs] = ids
|
||||
cachePartition = utils.CacheStatQueueProfiles
|
||||
}
|
||||
}
|
||||
@@ -812,8 +812,8 @@ func (ldr *Loader) removeLoadedData(loaderType string, lds map[string][]LoaderDa
|
||||
if err := ldr.dm.RemoveThreshold(tntIDStruct.Tenant, tntIDStruct.ID, utils.NonTransactional); err != nil {
|
||||
return err
|
||||
}
|
||||
cacheArgs.ThresholdProfileIDs = ids
|
||||
cacheArgs.ThresholdIDs = ids
|
||||
cacheArgs[utils.ThresholdProfileIDs] = ids
|
||||
cacheArgs[utils.ThresholdIDs] = ids
|
||||
cachePartition = utils.CacheThresholdProfiles
|
||||
}
|
||||
}
|
||||
@@ -831,7 +831,7 @@ func (ldr *Loader) removeLoadedData(loaderType string, lds map[string][]LoaderDa
|
||||
tntIDStruct.ID, utils.NonTransactional, true); err != nil {
|
||||
return err
|
||||
}
|
||||
cacheArgs.RouteProfileIDs = ids
|
||||
cacheArgs[utils.RouteProfileIDs] = ids
|
||||
cachePartition = utils.CacheRouteProfiles
|
||||
}
|
||||
}
|
||||
@@ -849,7 +849,7 @@ func (ldr *Loader) removeLoadedData(loaderType string, lds map[string][]LoaderDa
|
||||
tntIDStruct.ID, utils.NonTransactional, true); err != nil {
|
||||
return err
|
||||
}
|
||||
cacheArgs.ChargerProfileIDs = ids
|
||||
cacheArgs[utils.ChargerProfileIDs] = ids
|
||||
cachePartition = utils.CacheChargerProfiles
|
||||
}
|
||||
}
|
||||
@@ -867,7 +867,7 @@ func (ldr *Loader) removeLoadedData(loaderType string, lds map[string][]LoaderDa
|
||||
tntIDStruct.ID, utils.NonTransactional, true); err != nil {
|
||||
return err
|
||||
}
|
||||
cacheArgs.DispatcherProfileIDs = ids
|
||||
cacheArgs[utils.DispatcherProfileIDs] = ids
|
||||
cachePartition = utils.CacheDispatcherProfiles
|
||||
}
|
||||
}
|
||||
@@ -885,7 +885,7 @@ func (ldr *Loader) removeLoadedData(loaderType string, lds map[string][]LoaderDa
|
||||
tntIDStruct.ID, utils.NonTransactional); err != nil {
|
||||
return err
|
||||
}
|
||||
cacheArgs.DispatcherHostIDs = ids
|
||||
cacheArgs[utils.DispatcherHostIDs] = ids
|
||||
cachePartition = utils.CacheDispatcherHosts
|
||||
}
|
||||
}
|
||||
@@ -917,7 +917,7 @@ func (ldr *Loader) removeLoadedData(loaderType string, lds map[string][]LoaderDa
|
||||
}
|
||||
}
|
||||
|
||||
cacheArgs.RateProfileIDs = ids
|
||||
cacheArgs[utils.RateProfileIDs] = ids
|
||||
cachePartition = utils.CacheRateProfiles
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ import (
|
||||
|
||||
func TestEventExporterSReload(t *testing.T) {
|
||||
for _, dir := range []string{"/tmp/testCSV", "/tmp/testComposedCSV", "/tmp/testFWV", "/tmp/testCSVMasked",
|
||||
"/tmp/testCSVfromVirt"} {
|
||||
"/tmp/testCSVfromVirt", "/tmp/testCSVExpTemp"} {
|
||||
if err := os.RemoveAll(dir); err != nil {
|
||||
t.Fatal("Error removing folder: ", dir, err)
|
||||
}
|
||||
|
||||
@@ -438,32 +438,6 @@ type AttrGetAccountsCount struct {
|
||||
Tenant string
|
||||
}
|
||||
|
||||
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
|
||||
RouteProfileIDs []string
|
||||
AttributeProfileIDs []string
|
||||
ChargerProfileIDs []string
|
||||
DispatcherProfileIDs []string
|
||||
DispatcherHostIDs []string
|
||||
DispatcherRoutesIDs []string
|
||||
RateProfileIDs []string
|
||||
}
|
||||
|
||||
type AttrExpFileCdrs struct {
|
||||
CdrFormat *string // Cdr output file format <CdreCdrFormats>
|
||||
FieldSeparator *string // Separator used between fields
|
||||
@@ -1318,10 +1292,40 @@ type ArgsGetCacheItemWithOpts struct {
|
||||
ArgsGetCacheItem
|
||||
}
|
||||
|
||||
// NewAttrReloadCacheWithOpts returns the ArgCache populated with nil
|
||||
func NewAttrReloadCacheWithOpts() *AttrReloadCacheWithOpts {
|
||||
return &AttrReloadCacheWithOpts{
|
||||
ArgsCache: map[string][]string{
|
||||
DestinationIDs: nil,
|
||||
ReverseDestinationIDs: nil,
|
||||
RatingPlanIDs: nil,
|
||||
RatingProfileIDs: nil,
|
||||
ActionIDs: nil,
|
||||
ActionPlanIDs: nil,
|
||||
AccountActionPlanIDs: nil,
|
||||
ActionTriggerIDs: nil,
|
||||
SharedGroupIDs: nil,
|
||||
ResourceProfileIDs: nil,
|
||||
ResourceIDs: nil,
|
||||
StatsQueueIDs: nil,
|
||||
StatsQueueProfileIDs: nil,
|
||||
ThresholdIDs: nil,
|
||||
ThresholdProfileIDs: nil,
|
||||
FilterIDs: nil,
|
||||
RouteProfileIDs: nil,
|
||||
AttributeProfileIDs: nil,
|
||||
ChargerProfileIDs: nil,
|
||||
DispatcherProfileIDs: nil,
|
||||
DispatcherHostIDs: nil,
|
||||
RateProfileIDs: nil,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
type AttrReloadCacheWithOpts struct {
|
||||
Opts map[string]interface{}
|
||||
TenantArg
|
||||
ArgsCache
|
||||
ArgsCache map[string][]string
|
||||
}
|
||||
|
||||
type AttrCacheIDsWithOpts struct {
|
||||
|
||||
@@ -142,7 +142,55 @@ var (
|
||||
TBLTPRateProfiles: CacheTBLTPRateProfiles,
|
||||
}
|
||||
// ProtectedSFlds are the fields that sessions should not alter
|
||||
ProtectedSFlds = NewStringSet([]string{CGRID, OriginHost, OriginID, Usage})
|
||||
ProtectedSFlds = NewStringSet([]string{CGRID, OriginHost, OriginID, Usage})
|
||||
ArgCacheToPrefix = map[string]string{
|
||||
DestinationIDs: DESTINATION_PREFIX,
|
||||
ReverseDestinationIDs: REVERSE_DESTINATION_PREFIX,
|
||||
RatingPlanIDs: RATING_PLAN_PREFIX,
|
||||
RatingProfileIDs: RATING_PROFILE_PREFIX,
|
||||
ActionIDs: ACTION_PREFIX,
|
||||
ActionPlanIDs: ACTION_PLAN_PREFIX,
|
||||
AccountActionPlanIDs: AccountActionPlansPrefix,
|
||||
ActionTriggerIDs: ACTION_TRIGGER_PREFIX,
|
||||
SharedGroupIDs: SHARED_GROUP_PREFIX,
|
||||
ResourceProfileIDs: ResourceProfilesPrefix,
|
||||
ResourceIDs: ResourcesPrefix,
|
||||
StatsQueueIDs: StatQueuePrefix,
|
||||
StatsQueueProfileIDs: StatQueueProfilePrefix,
|
||||
ThresholdIDs: ThresholdPrefix,
|
||||
ThresholdProfileIDs: ThresholdProfilePrefix,
|
||||
FilterIDs: FilterPrefix,
|
||||
RouteProfileIDs: RouteProfilePrefix,
|
||||
AttributeProfileIDs: AttributeProfilePrefix,
|
||||
ChargerProfileIDs: ChargerProfilePrefix,
|
||||
DispatcherProfileIDs: DispatcherProfilePrefix,
|
||||
DispatcherHostIDs: DispatcherHostPrefix,
|
||||
RateProfileIDs: RateProfilePrefix,
|
||||
}
|
||||
ArgCacheToInstance = map[string]string{
|
||||
DestinationIDs: CacheDestinations,
|
||||
ReverseDestinationIDs: CacheReverseDestinations,
|
||||
RatingPlanIDs: CacheRatingPlans,
|
||||
RatingProfileIDs: CacheRatingProfiles,
|
||||
ActionIDs: CacheActions,
|
||||
ActionPlanIDs: CacheActionPlans,
|
||||
AccountActionPlanIDs: CacheAccountActionPlans,
|
||||
ActionTriggerIDs: CacheActionTriggers,
|
||||
SharedGroupIDs: CacheSharedGroups,
|
||||
ResourceProfileIDs: CacheResourceProfiles,
|
||||
ResourceIDs: CacheResources,
|
||||
StatsQueueIDs: CacheStatQueues,
|
||||
StatsQueueProfileIDs: CacheStatQueueProfiles,
|
||||
ThresholdIDs: CacheThresholds,
|
||||
ThresholdProfileIDs: CacheThresholdProfiles,
|
||||
FilterIDs: CacheFilters,
|
||||
RouteProfileIDs: CacheRouteProfiles,
|
||||
AttributeProfileIDs: CacheAttributeProfiles,
|
||||
ChargerProfileIDs: CacheChargerProfiles,
|
||||
DispatcherProfileIDs: CacheDispatcherProfiles,
|
||||
DispatcherHostIDs: CacheDispatcherHosts,
|
||||
RateProfileIDs: CacheRateProfiles,
|
||||
}
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -510,13 +558,11 @@ const (
|
||||
MetaReas = "*reas"
|
||||
MetaReds = "*reds"
|
||||
Weight = "Weight"
|
||||
ThresholdIDs = "ThresholdIDs"
|
||||
Cost = "Cost"
|
||||
Limit = "Limit"
|
||||
UsageTTL = "UsageTTL"
|
||||
AllocationMessage = "AllocationMessage"
|
||||
Stored = "Stored"
|
||||
DestinationIDs = "DestinationIDs"
|
||||
RatingSubject = "RatingSubject"
|
||||
Categories = "Categories"
|
||||
Blocker = "Blocker"
|
||||
@@ -568,11 +614,9 @@ const (
|
||||
MetaCgrep = "*cgrep"
|
||||
MetaCGRAReq = "*cgrareq"
|
||||
CGR_ACD = "cgr_acd"
|
||||
FilterIDs = "FilterIDs"
|
||||
ActivationIntervalString = "ActivationInterval"
|
||||
MaxHits = "MaxHits"
|
||||
MinHits = "MinHits"
|
||||
ActionIDs = "ActionIDs"
|
||||
Async = "Async"
|
||||
Sorting = "Sorting"
|
||||
SortingParameters = "SortingParameters"
|
||||
@@ -709,7 +753,6 @@ const (
|
||||
MetaSTIRInitiate = "*stir_initiate"
|
||||
MetaInit = "*init"
|
||||
MetaRatingPlanCost = "*rating_plan_cost"
|
||||
RatingPlanIDs = "RatingPlanIDs"
|
||||
ERs = "ERs"
|
||||
EEs = "EEs"
|
||||
Ratio = "Ratio"
|
||||
@@ -2280,6 +2323,33 @@ const (
|
||||
FalseStr = "false"
|
||||
)
|
||||
|
||||
// ArgCache constats
|
||||
const (
|
||||
DestinationIDs = "DestinationIDs"
|
||||
ReverseDestinationIDs = "ReverseDestinationIDs"
|
||||
RatingPlanIDs = "RatingPlanIDs"
|
||||
RatingProfileIDs = "RatingProfileIDs"
|
||||
ActionIDs = "ActionIDs"
|
||||
ActionPlanIDs = "ActionPlanIDs"
|
||||
AccountActionPlanIDs = "AccountActionPlanIDs"
|
||||
ActionTriggerIDs = "ActionTriggerIDs"
|
||||
SharedGroupIDs = "SharedGroupIDs"
|
||||
ResourceProfileIDs = "ResourceProfileIDs"
|
||||
ResourceIDs = "ResourceIDs"
|
||||
StatsQueueIDs = "StatsQueueIDs"
|
||||
StatsQueueProfileIDs = "StatsQueueProfileIDs"
|
||||
ThresholdIDs = "ThresholdIDs"
|
||||
ThresholdProfileIDs = "ThresholdProfileIDs"
|
||||
FilterIDs = "FilterIDs"
|
||||
RouteProfileIDs = "RouteProfileIDs"
|
||||
AttributeProfileIDs = "AttributeProfileIDs"
|
||||
ChargerProfileIDs = "ChargerProfileIDs"
|
||||
DispatcherProfileIDs = "DispatcherProfileIDs"
|
||||
DispatcherHostIDs = "DispatcherHostIDs"
|
||||
DispatcherRoutesIDs = "DispatcherRoutesIDs"
|
||||
RateProfileIDs = "RateProfileIDs"
|
||||
)
|
||||
|
||||
func buildCacheInstRevPrefixes() {
|
||||
CachePrefixToInstance = make(map[string]string)
|
||||
for k, v := range CacheInstanceToPrefix {
|
||||
|
||||
Reference in New Issue
Block a user