Added migrator for *load_ids

This commit is contained in:
Trial97
2019-10-09 18:08:08 +03:00
committed by Dan Christian Bogos
parent 4f96ca590b
commit 8cddeca1a0
9 changed files with 81 additions and 0 deletions

View File

@@ -130,6 +130,7 @@ type DataDB interface {
RemoveDispatcherProfileDrv(string, string) error
GetItemLoadIDsDrv(itemIDPrefix string) (loadIDs map[string]int64, err error)
SetLoadIDsDrv(loadIDs map[string]int64) error
RemoveLoadIDsDrv() error
GetDispatcherHostDrv(string, string) (*DispatcherHost, error)
SetDispatcherHostDrv(*DispatcherHost) error
RemoveDispatcherHostDrv(string, string) error

View File

@@ -1049,3 +1049,7 @@ func (iDB *InternalDB) RemoveDispatcherHostDrv(tenant, id string) (err error) {
cacheCommit(utils.NonTransactional), utils.NonTransactional)
return
}
func (iDB *InternalDB) RemoveLoadIDsDrv() (err error) {
return utils.ErrNotImplemented
}

View File

@@ -1451,3 +1451,7 @@ func (ms *MapStorage) SetLoadIDsDrv(loadIDs map[string]int64) (err error) {
ms.mu.Unlock()
return
}
func (ms *MapStorage) RemoveLoadIDsDrv() (err error) {
return utils.ErrNotImplemented
}

View File

@@ -2274,3 +2274,10 @@ func (ms *MongoStorage) SetLoadIDsDrv(loadIDs map[string]int64) (err error) {
return err
})
}
func (ms *MongoStorage) RemoveLoadIDsDrv() (err error) {
return ms.query(func(sctx mongo.SessionContext) (err error) {
_, err = ms.getCol(ColLID).DeleteMany(sctx, bson.M{})
return err
})
}

View File

@@ -1675,3 +1675,7 @@ func (rs *RedisStorage) GetItemLoadIDsDrv(itemIDPrefix string) (loadIDs map[stri
func (rs *RedisStorage) SetLoadIDsDrv(loadIDs map[string]int64) error {
return rs.Cmd(redis_HMSET, utils.LoadIDs, loadIDs).Err
}
func (rs *RedisStorage) RemoveLoadIDsDrv() (err error) {
return rs.Cmd(redis_DEL, utils.LoadIDs).Err
}

View File

@@ -33,6 +33,7 @@ var (
utils.ActionPlans: "cgr-migrator -exec=*action_plans",
utils.SharedGroups: "cgr-migrator -exec=*shared_groups",
utils.Thresholds: "cgr-migrator -exec=*thresholds",
utils.LoadIDsVrs: "cgr-migrator -exec=*load_ids",
}
storDBVers = map[string]string{
utils.CostDetails: "cgr-migrator -exec=*cost_details",
@@ -155,6 +156,7 @@ func CurrentDataDBVersions() Versions {
utils.RatingProfile: 1,
utils.Chargers: 1,
utils.Dispatchers: 1,
utils.LoadIDsVrs: 1,
}
}