mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Splitted CachePartitions constants in different partitions
This commit is contained in:
committed by
Dan Christian Bogos
parent
8ef0624b9d
commit
c1c5e62751
@@ -42,29 +42,32 @@ var (
|
||||
MetaS3jsonMap: ContentJSON,
|
||||
}
|
||||
|
||||
// CachePartitions enables creation of cache partitions
|
||||
CachePartitions = NewStringSet([]string{CacheDestinations, CacheReverseDestinations,
|
||||
CacheRatingPlans, CacheRatingProfiles, CacheActions, CacheActionPlans,
|
||||
CacheAccountActionPlans, CacheActionTriggers, CacheSharedGroups, CacheTimings,
|
||||
CacheResourceProfiles, CacheResources, CacheEventResources, CacheStatQueueProfiles,
|
||||
CacheStatQueues, CacheThresholdProfiles, CacheThresholds, CacheFilters,
|
||||
CacheRouteProfiles, CacheAttributeProfiles, CacheChargerProfiles, CacheActionProfiles,
|
||||
CacheDispatcherProfiles, CacheDispatcherHosts, CacheDispatchers, CacheResourceFilterIndexes,
|
||||
CacheStatFilterIndexes, CacheThresholdFilterIndexes, CacheRouteFilterIndexes,
|
||||
CacheAttributeFilterIndexes, CacheChargerFilterIndexes, CacheDispatcherFilterIndexes,
|
||||
CacheDispatcherRoutes, CacheDispatcherLoads, CacheDiameterMessages, CacheRPCResponses,
|
||||
CacheClosedSessions, CacheCDRIDs, CacheLoadIDs, CacheRPCConnections, CacheRatingProfilesTmp,
|
||||
CacheUCH, CacheSTIR, CacheEventCharges, CacheRateProfiles, CacheRateProfilesFilterIndexes,
|
||||
CacheRateFilterIndexes, CacheActionProfilesFilterIndexes, CacheAccountProfilesFilterIndexes,
|
||||
CacheAccountProfiles, CacheReverseFilterIndexes, MetaAPIBan, CacheCapsEvents,
|
||||
// only internalDB
|
||||
CacheVersions, CacheAccounts,
|
||||
CacheTBLTPTimings, CacheTBLTPDestinations, CacheTBLTPRates, CacheTBLTPDestinationRates,
|
||||
extraDBPartition = NewStringSet([]string{CacheDispatchers,
|
||||
CacheDispatcherRoutes, CacheDispatcherLoads, CacheDiameterMessages, CacheRPCResponses, CacheClosedSessions,
|
||||
CacheCDRIDs, CacheRPCConnections, CacheUCH, CacheSTIR, CacheEventCharges, MetaAPIBan,
|
||||
CacheCapsEvents, CacheVersions})
|
||||
|
||||
dataDBPartition = NewStringSet([]string{CacheDestinations, CacheReverseDestinations, CacheRatingPlans,
|
||||
CacheRatingProfiles, CacheActions, CacheActionTriggers, CacheSharedGroups, CacheTimings,
|
||||
CacheResourceProfiles, CacheResources, CacheEventResources, CacheStatQueueProfiles, CacheStatQueues,
|
||||
CacheThresholdProfiles, CacheThresholds, CacheFilters, CacheRouteProfiles, CacheAttributeProfiles,
|
||||
CacheChargerProfiles, CacheActionProfiles, CacheDispatcherProfiles, CacheDispatcherHosts,
|
||||
CacheResourceFilterIndexes, CacheStatFilterIndexes, CacheThresholdFilterIndexes, CacheRouteFilterIndexes,
|
||||
CacheAttributeFilterIndexes, CacheChargerFilterIndexes, CacheDispatcherFilterIndexes, CacheLoadIDs,
|
||||
CacheRatingProfilesTmp, CacheRateProfiles, CacheRateProfilesFilterIndexes, CacheRateFilterIndexes,
|
||||
CacheActionProfilesFilterIndexes, CacheAccountProfilesFilterIndexes, CacheReverseFilterIndexes,
|
||||
CacheActionPlans, CacheAccountActionPlans, CacheAccountProfiles, CacheAccounts})
|
||||
|
||||
storDBPartition = NewStringSet([]string{CacheTBLTPTimings, CacheTBLTPDestinations, CacheTBLTPRates, CacheTBLTPDestinationRates,
|
||||
CacheTBLTPRatingPlans, CacheTBLTPRatingProfiles, CacheTBLTPSharedGroups, CacheTBLTPActions,
|
||||
CacheTBLTPActionPlans, CacheTBLTPActionTriggers, CacheTBLTPAccountActions, CacheTBLTPResources,
|
||||
CacheTBLTPStats, CacheTBLTPThresholds, CacheTBLTPFilters, CacheSessionCostsTBL, CacheCDRsTBL,
|
||||
CacheTBLTPRoutes, CacheTBLTPAttributes, CacheTBLTPChargers, CacheTBLTPDispatchers,
|
||||
CacheTBLTPDispatcherHosts, CacheTBLTPRateProfiles, CacheTBLTPActionProfiles, CacheTBLTPAccountProfiles})
|
||||
|
||||
// CachePartitions enables creation of cache partitions
|
||||
CachePartitions = Join(extraDBPartition, dataDBPartition, storDBPartition)
|
||||
|
||||
CacheInstanceToPrefix = map[string]string{
|
||||
CacheDestinations: DestinationPrefix,
|
||||
CacheReverseDestinations: ReverseDestinationPrefix,
|
||||
|
||||
@@ -18,7 +18,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
|
||||
package utils
|
||||
|
||||
import "sort"
|
||||
import (
|
||||
"sort"
|
||||
)
|
||||
|
||||
// NewStringSet returns a new StringSet
|
||||
func NewStringSet(dataSlice []string) (s StringSet) {
|
||||
@@ -109,3 +111,13 @@ func (s StringSet) GetOne() string {
|
||||
}
|
||||
return EmptyString
|
||||
}
|
||||
|
||||
func Join(s ...StringSet) (conc StringSet) {
|
||||
conc = make(StringSet)
|
||||
for _, k := range s {
|
||||
for key := range k {
|
||||
conc.Add(key)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -235,3 +235,27 @@ func TestGetOne(t *testing.T) {
|
||||
t.Errorf("Expected %+v, received %+v", EmptyString, value)
|
||||
}
|
||||
}
|
||||
|
||||
func TestStringSetJoin(t *testing.T) {
|
||||
set1 := StringSet{
|
||||
"test1": struct{}{},
|
||||
}
|
||||
set2 := StringSet{
|
||||
"test2": struct{}{},
|
||||
"test5": struct{}{},
|
||||
}
|
||||
set3 := StringSet{
|
||||
"test3": struct{}{},
|
||||
}
|
||||
rcv := Join(set1, set2, set3)
|
||||
|
||||
expected := StringSet{
|
||||
"test1": struct{}{},
|
||||
"test2": struct{}{},
|
||||
"test3": struct{}{},
|
||||
"test5": struct{}{},
|
||||
}
|
||||
if !reflect.DeepEqual(rcv, expected) {
|
||||
t.Errorf("Expected %+v, received %+v", ToJSON(expected), ToJSON(rcv))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user