Merge branch 'master' of github.com:cgrates/cgrates

This commit is contained in:
DanB
2017-09-05 18:41:06 +02:00
20 changed files with 54 additions and 34 deletions

View File

@@ -348,7 +348,7 @@ func init() {
csvr.WriteToDatabase(false, false, false)
cache.Flush()
dataStorage.LoadRatingCache(nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil)
dataStorage.LoadAccountingCache(nil, nil, nil)
dataStorage.LoadAccountingCache(nil, nil, nil, nil)
}
func TestLoadDestinations(t *testing.T) {

View File

@@ -60,9 +60,9 @@ var sTestsOnStorIT = []func(t *testing.T){
testOnStorITCacheLCR,
testOnStorITCacheAlias,
testOnStorITCacheReverseAlias,
testOnStorITCacheResource,
testOnStorITCacheResourceCfg,
testOnStorITCacheTiming,
testOnStorITCacheResource,
// ToDo: test cache flush for a prefix
// ToDo: testOnStorITLoadAccountingCache
testOnStorITHasData,
@@ -84,9 +84,9 @@ var sTestsOnStorIT = []func(t *testing.T){
testOnStorITCRUDUser,
testOnStorITCRUDAlias,
testOnStorITCRUDReverseAlias,
testOnStorITCRUDResource,
testOnStorITCRUDResourceCfg,
testOnStorITCRUDTiming,
testOnStorITCRUDResource,
testOnStorITCRUDHistory,
testOnStorITCRUDStructVersion,
testOnStorITCRUDSQStoredMetrics,
@@ -851,7 +851,6 @@ func testOnStorITCacheTiming(t *testing.T) {
}
}
//test here Cache
func testOnStorITCacheResource(t *testing.T) {
res := &Resource{
ID: "RL1",
@@ -1892,7 +1891,6 @@ func testOnStorITCRUDHistory(t *testing.T) {
}
}
//test here Crud
func testOnStorITCRUDResource(t *testing.T) {
res := &Resource{
ID: "RL1",

View File

@@ -80,7 +80,7 @@ type DataDB interface {
RemAccountActionPlans(acntID string, apIDs []string) (err error)
PushTask(*Task) error
PopTask() (*Task, error)
LoadAccountingCache(alsIDs, rvAlsIDs, rlIDs []string) error
LoadAccountingCache(alsIDs, rvAlsIDs, rlIDs, resIDs []string) error
GetAccount(string) (*Account, error)
SetAccount(*Account) error
RemoveAccount(string) error

View File

@@ -165,7 +165,7 @@ func (ms *MapStorage) LoadRatingCache(dstIDs, rvDstIDs, rplIDs, rpfIDs, actIDs,
return
}
func (ms *MapStorage) LoadAccountingCache(alsIDs, rvAlsIDs, rlIDs []string) error {
func (ms *MapStorage) LoadAccountingCache(alsIDs, rvAlsIDs, rlIDs, resIDs []string) error {
if ms.cacheCfg == nil {
return nil
}

View File

@@ -438,11 +438,12 @@ func (ms *MongoStorage) LoadRatingCache(dstIDs, rvDstIDs, rplIDs, rpfIDs, actIDs
return
}
func (ms *MongoStorage) LoadAccountingCache(alsIDs, rvAlsIDs, rlIDs []string) (err error) {
func (ms *MongoStorage) LoadAccountingCache(alsIDs, rvAlsIDs, rlIDs, resIDs []string) (err error) {
for key, ids := range map[string][]string{
utils.ALIASES_PREFIX: alsIDs,
utils.REVERSE_ALIASES_PREFIX: rvAlsIDs,
utils.ResourceConfigsPrefix: rlIDs,
utils.ResourcesPrefix: resIDs,
} {
if err = ms.CacheDataFromDB(key, ids, false); err != nil {
return
@@ -1905,8 +1906,6 @@ func (ms *MongoStorage) RemoveResourceCfg(id string, transactionID string) (err
return nil
}
//from here
//find the right collumn
func (ms *MongoStorage) GetResource(id string, skipCache bool, transactionID string) (r *Resource, err error) {
key := utils.ResourcesPrefix + id
if !skipCache {
@@ -1948,8 +1947,6 @@ func (ms *MongoStorage) RemoveResource(id string, transactionID string) (err err
return nil
}
//to here
func (ms *MongoStorage) GetTiming(id string, skipCache bool, transactionID string) (t *utils.TPTiming, err error) {
key := utils.TimingsPrefix + id
if !skipCache {

View File

@@ -140,11 +140,12 @@ func (rs *RedisStorage) LoadRatingCache(dstIDs, rvDstIDs, rplIDs, rpfIDs, actIDs
return
}
func (rs *RedisStorage) LoadAccountingCache(alsIDs, rvAlsIDs, rlIDs []string) (err error) {
func (rs *RedisStorage) LoadAccountingCache(alsIDs, rvAlsIDs, rlIDs, resIDs []string) (err error) {
for key, ids := range map[string][]string{
utils.ALIASES_PREFIX: alsIDs,
utils.REVERSE_ALIASES_PREFIX: rvAlsIDs,
utils.ResourceConfigsPrefix: rlIDs,
utils.ResourcesPrefix: resIDs,
} {
if err = rs.CacheDataFromDB(key, ids, false); err != nil {
return
@@ -1424,7 +1425,6 @@ func (rs *RedisStorage) RemoveResourceCfg(id string, transactionID string) (err
return
}
//from here
func (rs *RedisStorage) GetResource(id string, skipCache bool, transactionID string) (r *Resource, err error) {
key := utils.ResourcesPrefix + id
if !skipCache {
@@ -1467,8 +1467,6 @@ func (rs *RedisStorage) RemoveResource(id string, transactionID string) (err err
return
}
// to here
func (rs *RedisStorage) GetTiming(id string, skipCache bool, transactionID string) (t *utils.TPTiming, err error) {
key := utils.TimingsPrefix + id
if !skipCache {