mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Added cache reload for indexes
This commit is contained in:
committed by
Dan Christian Bogos
parent
4888034ea3
commit
e2049ae318
@@ -1495,7 +1495,18 @@ func testApierResetDataAfterLoadFromFolder(t *testing.T) {
|
||||
expStats[utils.CacheRouteProfiles].Items = 2
|
||||
expStats[utils.CacheThresholdProfiles].Items = 1
|
||||
expStats[utils.CacheThresholds].Items = 1
|
||||
expStats[utils.CacheLoadIDs].Items = 22
|
||||
expStats[utils.CacheLoadIDs].Items = 33
|
||||
expStats[utils.CacheTimings].Items = 12
|
||||
expStats[utils.CacheThresholdFilterIndexes].Items = 5
|
||||
expStats[utils.CacheThresholdFilterIndexes].Groups = 1
|
||||
expStats[utils.CacheStatFilterIndexes].Items = 2
|
||||
expStats[utils.CacheStatFilterIndexes].Groups = 1
|
||||
expStats[utils.CacheRouteFilterIndexes].Items = 2
|
||||
expStats[utils.CacheRouteFilterIndexes].Groups = 1
|
||||
expStats[utils.CacheResourceFilterIndexes].Items = 5
|
||||
expStats[utils.CacheResourceFilterIndexes].Groups = 1
|
||||
expStats[utils.CacheAttributeFilterIndexes].Items = 4
|
||||
expStats[utils.CacheAttributeFilterIndexes].Groups = 1
|
||||
|
||||
if err := rater.Call(utils.CacheSv1GetCacheStats, new(utils.AttrCacheIDsWithOpts), &rcvStats); err != nil {
|
||||
t.Error(err)
|
||||
|
||||
@@ -160,7 +160,18 @@ func testCacheSAfterLoadFromFolder(t *testing.T) {
|
||||
expStats[utils.CacheRouteProfiles].Items = 2
|
||||
expStats[utils.CacheThresholdProfiles].Items = 1
|
||||
expStats[utils.CacheThresholds].Items = 1
|
||||
expStats[utils.CacheLoadIDs].Items = 22
|
||||
expStats[utils.CacheLoadIDs].Items = 33
|
||||
expStats[utils.CacheTimings].Items = 12
|
||||
expStats[utils.CacheThresholdFilterIndexes].Items = 5
|
||||
expStats[utils.CacheThresholdFilterIndexes].Groups = 1
|
||||
expStats[utils.CacheStatFilterIndexes].Items = 2
|
||||
expStats[utils.CacheStatFilterIndexes].Groups = 1
|
||||
expStats[utils.CacheRouteFilterIndexes].Items = 2
|
||||
expStats[utils.CacheRouteFilterIndexes].Groups = 1
|
||||
expStats[utils.CacheResourceFilterIndexes].Items = 5
|
||||
expStats[utils.CacheResourceFilterIndexes].Groups = 1
|
||||
expStats[utils.CacheAttributeFilterIndexes].Items = 4
|
||||
expStats[utils.CacheAttributeFilterIndexes].Groups = 1
|
||||
|
||||
if err := chcRPC.Call(utils.CacheSv1GetCacheStats, &utils.AttrCacheIDsWithOpts{}, &rcvStats); err != nil {
|
||||
t.Error(err)
|
||||
@@ -215,7 +226,18 @@ func testCacheSReload(t *testing.T) {
|
||||
expStats[utils.CacheRouteProfiles].Items = 2
|
||||
expStats[utils.CacheThresholdProfiles].Items = 1
|
||||
expStats[utils.CacheThresholds].Items = 1
|
||||
expStats[utils.CacheLoadIDs].Items = 22
|
||||
expStats[utils.CacheLoadIDs].Items = 33
|
||||
expStats[utils.CacheTimings].Items = 12
|
||||
expStats[utils.CacheThresholdFilterIndexes].Items = 5
|
||||
expStats[utils.CacheThresholdFilterIndexes].Groups = 1
|
||||
expStats[utils.CacheStatFilterIndexes].Items = 2
|
||||
expStats[utils.CacheStatFilterIndexes].Groups = 1
|
||||
expStats[utils.CacheRouteFilterIndexes].Items = 2
|
||||
expStats[utils.CacheRouteFilterIndexes].Groups = 1
|
||||
expStats[utils.CacheResourceFilterIndexes].Items = 5
|
||||
expStats[utils.CacheResourceFilterIndexes].Groups = 1
|
||||
expStats[utils.CacheAttributeFilterIndexes].Items = 4
|
||||
expStats[utils.CacheAttributeFilterIndexes].Groups = 1
|
||||
|
||||
if err := chcRPC.Call(utils.CacheSv1GetCacheStats, &utils.AttrCacheIDsWithOpts{}, &rcvStats); err != nil {
|
||||
t.Error(err)
|
||||
|
||||
@@ -38,31 +38,7 @@ func GetCacheOpt(apiOpt *string) string {
|
||||
// for a specific CacheID
|
||||
func composeArgsReload(args utils.ArgsGetCacheItem) (rpl map[string][]string) {
|
||||
// ToDo: make the load cache API compatible with gob encoding
|
||||
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: {},
|
||||
}
|
||||
rpl = make(map[string][]string)
|
||||
switch args.CacheID {
|
||||
case utils.CacheResourceProfiles:
|
||||
rpl[utils.ResourceProfileIDs] = []string{args.ItemID}
|
||||
|
||||
@@ -145,7 +145,20 @@ func testDspChcLoadAfterFolder(t *testing.T) {
|
||||
expStats[utils.CacheRouteProfiles].Items = 3
|
||||
expStats[utils.CacheThresholdProfiles].Items = 2
|
||||
expStats[utils.CacheThresholds].Items = 2
|
||||
expStats[utils.CacheLoadIDs].Items = 22
|
||||
expStats[utils.CacheLoadIDs].Items = 33
|
||||
expStats[utils.CacheTimings].Items = 10
|
||||
expStats[utils.CacheThresholdFilterIndexes].Items = 2
|
||||
expStats[utils.CacheThresholdFilterIndexes].Groups = 1
|
||||
expStats[utils.CacheStatFilterIndexes].Items = 7
|
||||
expStats[utils.CacheStatFilterIndexes].Groups = 1
|
||||
expStats[utils.CacheRouteFilterIndexes].Items = 3
|
||||
expStats[utils.CacheRouteFilterIndexes].Groups = 1
|
||||
expStats[utils.CacheResourceFilterIndexes].Items = 3
|
||||
expStats[utils.CacheResourceFilterIndexes].Groups = 1
|
||||
expStats[utils.CacheChargerFilterIndexes].Items = 1
|
||||
expStats[utils.CacheChargerFilterIndexes].Groups = 1
|
||||
expStats[utils.CacheAttributeFilterIndexes].Items = 10
|
||||
expStats[utils.CacheAttributeFilterIndexes].Groups = 4
|
||||
if err := dispEngine.RPC.Call(utils.CacheSv1GetCacheStats, &args, &rcvStats); err != nil {
|
||||
t.Error(err)
|
||||
} else if !reflect.DeepEqual(expStats, rcvStats) {
|
||||
|
||||
@@ -336,16 +336,14 @@ func (chS *CacheS) V1ReloadCache(attrs utils.AttrReloadCacheWithOpts, reply *str
|
||||
}
|
||||
}
|
||||
//get loadIDs from database for all types
|
||||
loadIDs, err := chS.dm.GetItemLoadIDs(utils.EmptyString, false)
|
||||
if err != nil {
|
||||
if err == utils.ErrNotFound { // we can receive cache reload from LoaderS and we store the LoadID only after all Items was processed
|
||||
loadIDs = make(map[string]int64)
|
||||
} else {
|
||||
return err
|
||||
var loadIDs map[string]int64
|
||||
if loadIDs, err = chS.dm.GetItemLoadIDs(utils.EmptyString, false); err != nil {
|
||||
if err != utils.ErrNotFound { // we can receive cache reload from LoaderS and we store the LoadID only after all Items was processed
|
||||
return
|
||||
}
|
||||
loadIDs = make(map[string]int64)
|
||||
}
|
||||
cacheLoadIDs := populateCacheLoadIDs(loadIDs, attrs.ArgsCache)
|
||||
for key, val := range cacheLoadIDs {
|
||||
for key, val := range populateCacheLoadIDs(loadIDs, attrs.ArgsCache) {
|
||||
chS.tCache.Set(utils.CacheLoadIDs, key, val, nil,
|
||||
cacheCommit(utils.NonTransactional), utils.NonTransactional)
|
||||
}
|
||||
@@ -361,20 +359,18 @@ func (chS *CacheS) V1LoadCache(attrs utils.AttrReloadCacheWithOpts, reply *strin
|
||||
args[prfx] = ids
|
||||
}
|
||||
}
|
||||
if err := chS.dm.LoadDataDBCache(args); err != nil {
|
||||
if err = chS.dm.LoadDataDBCache(args); err != nil {
|
||||
return utils.NewErrServerError(err)
|
||||
}
|
||||
//get loadIDs for all types
|
||||
loadIDs, err := chS.dm.GetItemLoadIDs(utils.EmptyString, false)
|
||||
if err != nil {
|
||||
if err == utils.ErrNotFound { // we can receive cache reload from LoaderS and we store the LoadID only after all Items was processed
|
||||
loadIDs = make(map[string]int64)
|
||||
} else {
|
||||
return err
|
||||
var loadIDs map[string]int64
|
||||
if loadIDs, err = chS.dm.GetItemLoadIDs(utils.EmptyString, false); err != nil {
|
||||
if err != utils.ErrNotFound { // we can receive cache reload from LoaderS and we store the LoadID only after all Items was processed
|
||||
return
|
||||
}
|
||||
loadIDs = make(map[string]int64)
|
||||
}
|
||||
cacheLoadIDs := populateCacheLoadIDs(loadIDs, attrs.ArgsCache)
|
||||
for key, val := range cacheLoadIDs {
|
||||
for key, val := range populateCacheLoadIDs(loadIDs, attrs.ArgsCache) {
|
||||
chS.tCache.Set(utils.CacheLoadIDs, key, val, nil,
|
||||
cacheCommit(utils.NonTransactional), utils.NonTransactional)
|
||||
}
|
||||
@@ -395,7 +391,7 @@ func populateCacheLoadIDs(loadIDs map[string]int64, attrs map[string][]string) (
|
||||
return
|
||||
}
|
||||
|
||||
// Replicate replicate an item to ReplicationConns
|
||||
// ReplicateSet replicate an item to ReplicationConns
|
||||
func (chS *CacheS) ReplicateSet(chID, itmID string, value interface{}) (err error) {
|
||||
if len(chS.cfg.CacheCfg().ReplicationConns) == 0 ||
|
||||
!chS.cfg.CacheCfg().Partitions[chID].Replicate {
|
||||
|
||||
@@ -26,49 +26,50 @@ import (
|
||||
|
||||
var (
|
||||
filterIndexesPrefixMap = utils.StringSet{
|
||||
utils.AttributeFilterIndexes: struct{}{},
|
||||
utils.ResourceFilterIndexes: struct{}{},
|
||||
utils.StatFilterIndexes: struct{}{},
|
||||
utils.ThresholdFilterIndexes: struct{}{},
|
||||
utils.RouteFilterIndexes: struct{}{},
|
||||
utils.ChargerFilterIndexes: struct{}{},
|
||||
utils.DispatcherFilterIndexes: struct{}{},
|
||||
utils.RateProfilesFilterIndexPrfx: struct{}{},
|
||||
utils.RateFilterIndexPrfx: struct{}{},
|
||||
utils.AttributeFilterIndexes: {},
|
||||
utils.ResourceFilterIndexes: {},
|
||||
utils.StatFilterIndexes: {},
|
||||
utils.ThresholdFilterIndexes: {},
|
||||
utils.RouteFilterIndexes: {},
|
||||
utils.ChargerFilterIndexes: {},
|
||||
utils.DispatcherFilterIndexes: {},
|
||||
utils.RateProfilesFilterIndexPrfx: {},
|
||||
utils.RateFilterIndexPrfx: {},
|
||||
}
|
||||
cachePrefixMap = utils.StringSet{
|
||||
utils.DESTINATION_PREFIX: struct{}{},
|
||||
utils.REVERSE_DESTINATION_PREFIX: struct{}{},
|
||||
utils.RATING_PLAN_PREFIX: struct{}{},
|
||||
utils.RATING_PROFILE_PREFIX: struct{}{},
|
||||
utils.ACTION_PREFIX: struct{}{},
|
||||
utils.ACTION_PLAN_PREFIX: struct{}{},
|
||||
utils.AccountActionPlansPrefix: struct{}{},
|
||||
utils.ACTION_TRIGGER_PREFIX: struct{}{},
|
||||
utils.SHARED_GROUP_PREFIX: struct{}{},
|
||||
utils.ResourceProfilesPrefix: struct{}{},
|
||||
utils.TimingsPrefix: struct{}{},
|
||||
utils.ResourcesPrefix: struct{}{},
|
||||
utils.StatQueuePrefix: struct{}{},
|
||||
utils.StatQueueProfilePrefix: struct{}{},
|
||||
utils.ThresholdPrefix: struct{}{},
|
||||
utils.ThresholdProfilePrefix: struct{}{},
|
||||
utils.FilterPrefix: struct{}{},
|
||||
utils.RouteProfilePrefix: struct{}{},
|
||||
utils.AttributeProfilePrefix: struct{}{},
|
||||
utils.ChargerProfilePrefix: struct{}{},
|
||||
utils.DispatcherProfilePrefix: struct{}{},
|
||||
utils.DispatcherHostPrefix: struct{}{},
|
||||
utils.RateProfilePrefix: struct{}{},
|
||||
utils.AttributeFilterIndexes: struct{}{},
|
||||
utils.ResourceFilterIndexes: struct{}{},
|
||||
utils.StatFilterIndexes: struct{}{},
|
||||
utils.ThresholdFilterIndexes: struct{}{},
|
||||
utils.RouteFilterIndexes: struct{}{},
|
||||
utils.ChargerFilterIndexes: struct{}{},
|
||||
utils.DispatcherFilterIndexes: struct{}{},
|
||||
utils.RateProfilesFilterIndexPrfx: struct{}{},
|
||||
utils.RateFilterIndexPrfx: struct{}{},
|
||||
utils.DESTINATION_PREFIX: {},
|
||||
utils.REVERSE_DESTINATION_PREFIX: {},
|
||||
utils.RATING_PLAN_PREFIX: {},
|
||||
utils.RATING_PROFILE_PREFIX: {},
|
||||
utils.ACTION_PREFIX: {},
|
||||
utils.ACTION_PLAN_PREFIX: {},
|
||||
utils.AccountActionPlansPrefix: {},
|
||||
utils.ACTION_TRIGGER_PREFIX: {},
|
||||
utils.SHARED_GROUP_PREFIX: {},
|
||||
utils.ResourceProfilesPrefix: {},
|
||||
utils.TimingsPrefix: {},
|
||||
utils.ResourcesPrefix: {},
|
||||
utils.StatQueuePrefix: {},
|
||||
utils.StatQueueProfilePrefix: {},
|
||||
utils.ThresholdPrefix: {},
|
||||
utils.ThresholdProfilePrefix: {},
|
||||
utils.FilterPrefix: {},
|
||||
utils.RouteProfilePrefix: {},
|
||||
utils.AttributeProfilePrefix: {},
|
||||
utils.ChargerProfilePrefix: {},
|
||||
utils.DispatcherProfilePrefix: {},
|
||||
utils.DispatcherHostPrefix: {},
|
||||
utils.RateProfilePrefix: {},
|
||||
utils.AttributeFilterIndexes: {},
|
||||
utils.ResourceFilterIndexes: {},
|
||||
utils.StatFilterIndexes: {},
|
||||
utils.ThresholdFilterIndexes: {},
|
||||
utils.RouteFilterIndexes: {},
|
||||
utils.ChargerFilterIndexes: {},
|
||||
utils.DispatcherFilterIndexes: {},
|
||||
utils.RateProfilesFilterIndexPrfx: {},
|
||||
utils.RateFilterIndexPrfx: {},
|
||||
utils.FilterIndexPrfx: {},
|
||||
}
|
||||
)
|
||||
|
||||
@@ -273,6 +274,9 @@ func (dm *DataManager) CacheDataFromDB(prfx string, ids []string, mustBeCached b
|
||||
return
|
||||
}
|
||||
_, err = dm.GetIndexes(utils.CacheRateFilterIndexes, tntCtx, idxKey, false, true)
|
||||
case utils.FilterIndexPrfx:
|
||||
tntID := utils.NewTenantID(dataID)
|
||||
_, err = dm.GetIndexes(utils.CacheReverseFilterIndexes, tntID.Tenant, tntID.ID, false, true)
|
||||
case utils.LoadIDPrefix:
|
||||
_, err = dm.GetItemLoadIDs(utils.EmptyString, true)
|
||||
}
|
||||
|
||||
@@ -351,7 +351,7 @@ func splitFilterIndex(tntCtxIdxKey string) (tntCtx, idxKey string, err error) {
|
||||
splt := utils.SplitConcatenatedKey(tntCtxIdxKey) // tntCtx:filterType:fieldName:fieldVal
|
||||
lsplt := len(splt)
|
||||
if lsplt < 4 {
|
||||
err = fmt.Errorf("WRONG_IDX_KEY_FORMAT")
|
||||
err = fmt.Errorf("WRONG_IDX_KEY_FORMAT<%s>", tntCtxIdxKey)
|
||||
return
|
||||
}
|
||||
tntCtx = utils.ConcatenatedKey(splt[:lsplt-3]...) // prefix may contain context/subsystems
|
||||
|
||||
@@ -554,27 +554,38 @@ func GetDefaultEmptyCacheStats() map[string]*ltcache.CacheStats {
|
||||
|
||||
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,
|
||||
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,
|
||||
utils.TimingsPrefix: nil,
|
||||
utils.AttributeFilterIndexes: nil,
|
||||
utils.ResourceFilterIndexes: nil,
|
||||
utils.StatFilterIndexes: nil,
|
||||
utils.ThresholdFilterIndexes: nil,
|
||||
utils.RouteFilterIndexes: nil,
|
||||
utils.ChargerFilterIndexes: nil,
|
||||
utils.DispatcherFilterIndexes: nil,
|
||||
utils.RateProfilesFilterIndexPrfx: nil,
|
||||
utils.RateFilterIndexPrfx: nil,
|
||||
utils.FilterIndexPrfx: nil,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,9 +155,22 @@ func testTutSMGCacheStats(t *testing.T) {
|
||||
expectedStats[utils.CacheAttributeProfiles].Items = 2
|
||||
expectedStats[utils.MetaDefault].Items = 1
|
||||
expectedStats[utils.CacheActionTriggers].Items = 1
|
||||
expectedStats[utils.CacheLoadIDs].Items = 22
|
||||
expectedStats[utils.CacheLoadIDs].Items = 33
|
||||
expectedStats[utils.CacheChargerProfiles].Items = 1
|
||||
expectedStats[utils.CacheRPCConnections].Items = 2
|
||||
expectedStats[utils.CacheTimings].Items = 14
|
||||
expectedStats[utils.CacheThresholdFilterIndexes].Items = 10
|
||||
expectedStats[utils.CacheThresholdFilterIndexes].Groups = 1
|
||||
expectedStats[utils.CacheStatFilterIndexes].Items = 2
|
||||
expectedStats[utils.CacheStatFilterIndexes].Groups = 1
|
||||
expectedStats[utils.CacheRouteFilterIndexes].Items = 6
|
||||
expectedStats[utils.CacheRouteFilterIndexes].Groups = 1
|
||||
expectedStats[utils.CacheResourceFilterIndexes].Items = 6
|
||||
expectedStats[utils.CacheResourceFilterIndexes].Groups = 1
|
||||
expectedStats[utils.CacheChargerFilterIndexes].Items = 1
|
||||
expectedStats[utils.CacheChargerFilterIndexes].Groups = 1
|
||||
expectedStats[utils.CacheAttributeFilterIndexes].Items = 3
|
||||
expectedStats[utils.CacheAttributeFilterIndexes].Groups = 2
|
||||
if err := tutSMGRpc.Call(utils.CacheSv1GetCacheStats, new(utils.AttrCacheIDsWithOpts), &rcvStats); err != nil {
|
||||
t.Error("Got error on CacheSv1.GetCacheStats: ", err.Error())
|
||||
} else if !reflect.DeepEqual(expectedStats, rcvStats) {
|
||||
|
||||
@@ -91,6 +91,7 @@ cgrates (0.11.0~dev) UNRELEASED; urgency=medium
|
||||
* [EEs] Add support for *template type
|
||||
* [LoaderS] In case of empty output directory path don't move the processed file
|
||||
* [FilterS] Added *ipnet filter to check if the network contains the IP
|
||||
* [CacheS] Updated ReloadCache and LoadCache APIs to use a map instead of a structure to be compatible with gob encoding
|
||||
|
||||
-- DanB <danb@cgrates.org> Wed, 19 Feb 2020 13:25:52 +0200
|
||||
|
||||
|
||||
@@ -1296,28 +1296,39 @@ type ArgsGetCacheItemWithOpts struct {
|
||||
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,
|
||||
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,
|
||||
TimingIDs: nil,
|
||||
AttributeFilterIndexIDs: nil,
|
||||
ResourceFilterIndexIDs: nil,
|
||||
StatFilterIndexIDs: nil,
|
||||
ThresholdFilterIndexIDs: nil,
|
||||
RouteFilterIndexIDs: nil,
|
||||
ChargerFilterIndexIDs: nil,
|
||||
DispatcherFilterIndexIDs: nil,
|
||||
RateProfilesFilterIndexIDs: nil,
|
||||
RateFilterIndexIDs: nil,
|
||||
FilterIndexIDs: nil,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,6 +166,18 @@ var (
|
||||
DispatcherProfileIDs: DispatcherProfilePrefix,
|
||||
DispatcherHostIDs: DispatcherHostPrefix,
|
||||
RateProfileIDs: RateProfilePrefix,
|
||||
|
||||
TimingIDs: TimingsPrefix,
|
||||
AttributeFilterIndexIDs: AttributeFilterIndexes,
|
||||
ResourceFilterIndexIDs: ResourceFilterIndexes,
|
||||
StatFilterIndexIDs: StatFilterIndexes,
|
||||
ThresholdFilterIndexIDs: ThresholdFilterIndexes,
|
||||
RouteFilterIndexIDs: RouteFilterIndexes,
|
||||
ChargerFilterIndexIDs: ChargerFilterIndexes,
|
||||
DispatcherFilterIndexIDs: DispatcherFilterIndexes,
|
||||
RateProfilesFilterIndexIDs: RateProfilesFilterIndexPrfx,
|
||||
RateFilterIndexIDs: RateFilterIndexPrfx,
|
||||
FilterIndexIDs: FilterIndexPrfx,
|
||||
}
|
||||
ArgCacheToInstance = map[string]string{
|
||||
DestinationIDs: CacheDestinations,
|
||||
@@ -190,6 +202,18 @@ var (
|
||||
DispatcherProfileIDs: CacheDispatcherProfiles,
|
||||
DispatcherHostIDs: CacheDispatcherHosts,
|
||||
RateProfileIDs: CacheRateProfiles,
|
||||
|
||||
TimingIDs: CacheTimings,
|
||||
AttributeFilterIndexIDs: CacheAttributeFilterIndexes,
|
||||
ResourceFilterIndexIDs: CacheResourceFilterIndexes,
|
||||
StatFilterIndexIDs: CacheStatFilterIndexes,
|
||||
ThresholdFilterIndexIDs: CacheThresholdFilterIndexes,
|
||||
RouteFilterIndexIDs: CacheRouteFilterIndexes,
|
||||
ChargerFilterIndexIDs: CacheChargerFilterIndexes,
|
||||
DispatcherFilterIndexIDs: CacheDispatcherFilterIndexes,
|
||||
RateProfilesFilterIndexIDs: CacheRateProfilesFilterIndexes,
|
||||
RateFilterIndexIDs: CacheRateFilterIndexes,
|
||||
FilterIndexIDs: CacheReverseFilterIndexes,
|
||||
}
|
||||
)
|
||||
|
||||
@@ -463,7 +487,6 @@ const (
|
||||
ActionPlans = "ActionPlans"
|
||||
ActionTriggers = "ActionTriggers"
|
||||
SharedGroups = "SharedGroups"
|
||||
TimingIDs = "TimingIDs"
|
||||
Timings = "Timings"
|
||||
Rates = "Rates"
|
||||
DestinationRates = "DestinationRates"
|
||||
@@ -2325,29 +2348,40 @@ const (
|
||||
|
||||
// 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"
|
||||
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"
|
||||
TimingIDs = "TimingIDs"
|
||||
AttributeFilterIndexIDs = "AttributeFilterIndexIDs"
|
||||
ResourceFilterIndexIDs = "ResourceFilterIndexIDs"
|
||||
StatFilterIndexIDs = "StatFilterIndexIDs"
|
||||
ThresholdFilterIndexIDs = "ThresholdFilterIndexIDs"
|
||||
RouteFilterIndexIDs = "RouteFilterIndexIDs"
|
||||
ChargerFilterIndexIDs = "ChargerFilterIndexIDs"
|
||||
DispatcherFilterIndexIDs = "DispatcherFilterIndexIDs"
|
||||
RateProfilesFilterIndexIDs = "RateProfilesFilterIndexIDs"
|
||||
RateFilterIndexIDs = "RateFilterIndexIDs"
|
||||
FilterIndexIDs = "FilterIndexIDs"
|
||||
)
|
||||
|
||||
func buildCacheInstRevPrefixes() {
|
||||
|
||||
Reference in New Issue
Block a user