diff --git a/engine/loader_csv.go b/engine/loader_csv.go index 2759eca48..2307f561d 100644 --- a/engine/loader_csv.go +++ b/engine/loader_csv.go @@ -280,7 +280,7 @@ func (csvr *CSVReader) LoadDestinationRates() (err error) { } } if !destinationExists { - if dbExists, err := csvr.storage.ExistsData(DESTINATION, record[1]); err != nil { + if dbExists, err := csvr.storage.ExistsData(DESTINATION_PREFIX, record[1]); err != nil { return err } else if !dbExists { return fmt.Errorf("Could not get destination for tag %v", record[1]) @@ -363,7 +363,7 @@ func (csvr *CSVReader) LoadRatingProfiles() (err error) { } _, exists := csvr.ratingPlans[record[5]] if !exists { - if dbExists, err := csvr.storage.ExistsData(RATING_PLAN, record[5]); err != nil { + if dbExists, err := csvr.storage.ExistsData(RATING_PLAN_PREFIX, record[5]); err != nil { return err } else if !dbExists { return errors.New(fmt.Sprintf("Could not load rating plans for tag: %v", record[5])) diff --git a/engine/loader_db.go b/engine/loader_db.go index be4a6c934..70aebf713 100644 --- a/engine/loader_db.go +++ b/engine/loader_db.go @@ -167,7 +167,7 @@ func (dbr *DbReader) LoadDestinationRates() (err error) { } } if !destinationExists { - if dbExists, err := dbr.dataDb.ExistsData(DESTINATION, dr.DestinationId); err != nil { + if dbExists, err := dbr.dataDb.ExistsData(DESTINATION_PREFIX, dr.DestinationId); err != nil { return err } else if !dbExists { return errors.New(fmt.Sprintf("Could not get destination for tag %v", dr.DestinationId)) @@ -219,7 +219,7 @@ func (dbr *DbReader) LoadRatingProfiles() error { } _, exists := dbr.ratingPlans[rp.RatingPlanId] if !exists { - if dbExists, err := dbr.dataDb.ExistsData(RATING_PLAN, rp.RatingPlanId); err != nil { + if dbExists, err := dbr.dataDb.ExistsData(RATING_PLAN_PREFIX, rp.RatingPlanId); err != nil { return err } else if !dbExists { return errors.New(fmt.Sprintf("Could not load rating plans for tag: %v", rp.RatingPlanId)) @@ -268,7 +268,7 @@ func (dbr *DbReader) LoadRatingPlanByTag(tag string) error { if err != nil { return err } else if len(dms) == 0 { - if dbExists, err := dbr.dataDb.ExistsData(DESTINATION, drate.DestinationId); err != nil { + if dbExists, err := dbr.dataDb.ExistsData(DESTINATION_PREFIX, drate.DestinationId); err != nil { return err } else if !dbExists { return fmt.Errorf("Could not get destination for tag %v", drate.DestinationId) @@ -301,7 +301,7 @@ func (dbr *DbReader) LoadRatingProfileByTag(tag string) error { // Check if referenced RatingPlan exists _, exists := dbr.ratingPlans[rp.RatingPlanId] if !exists { - if dbExists, err := dbr.dataDb.ExistsData(RATING_PLAN, rp.RatingPlanId); err != nil { + if dbExists, err := dbr.dataDb.ExistsData(RATING_PLAN_PREFIX, rp.RatingPlanId); err != nil { return err } else if !dbExists { return errors.New(fmt.Sprintf("Could not load rating plans for tag: %v", rp.RatingPlanId)) diff --git a/engine/storage_interface.go b/engine/storage_interface.go index 254cc6b1e..40a942fec 100644 --- a/engine/storage_interface.go +++ b/engine/storage_interface.go @@ -50,9 +50,6 @@ const ( MEDIATOR_SOURCE = "MED" SCHED_SOURCE = "SCH" RATER_SOURCE = "RAT" - DESTINATION = "destination" - RATING_PLAN = "rating_plan" - ) type Storage interface { diff --git a/engine/storage_map.go b/engine/storage_map.go index cf5ece059..d0b52e315 100644 --- a/engine/storage_map.go +++ b/engine/storage_map.go @@ -63,10 +63,10 @@ func (ms *MapStorage) PreCache(dKeys, rppKeys []string) error { // Used to check if specific subject is stored using prefix key attached to entity func (ms *MapStorage) ExistsData(categ, subject string) (bool, error) { switch categ { - case DESTINATION: + case DESTINATION_PREFIX: _, exists := ms.dict[DESTINATION_PREFIX+subject] return exists, nil - case RATING_PLAN: + case RATING_PLAN_PREFIX: _, exists := ms.dict[RATING_PLAN_PREFIX+subject] return exists, nil } diff --git a/engine/storage_redis.go b/engine/storage_redis.go index a85f4e79d..ac9b8a89c 100644 --- a/engine/storage_redis.go +++ b/engine/storage_redis.go @@ -108,9 +108,9 @@ func (rs *RedisStorage) PreCache(dKeys, rpKeys []string) (err error) { // Used to check if specific subject is stored using prefix key attached to entity func (rs *RedisStorage) ExistsData(entity, subject string) (bool, error) { switch entity { - case DESTINATION: + case DESTINATION_PREFIX: return rs.db.Exists(DESTINATION_PREFIX+subject) - case RATING_PLAN: + case RATING_PLAN_PREFIX: return rs.db.Exists(RATING_PLAN_PREFIX+subject) } return false, errors.New("Unsupported entity in ExistsData")