From d2c4d481f62506cd07da7dccdac6dc75eb827a31 Mon Sep 17 00:00:00 2001 From: TeoV Date: Fri, 11 May 2018 03:31:53 -0400 Subject: [PATCH] Renamed files in migrator --- migrator/migratorDataDB.go | 45 --------- migrator/migratorStorDB.go | 34 ------- migrator/migrator_utils.go | 22 ----- ...1mongo_data.go => storage_mongo_datadb.go} | 0 ...1mongo_stor.go => storage_mongo_stordb.go} | 0 migrator/{v1redis.go => storage_redis.go} | 0 migrator/{v1sql.go => storage_sql.go} | 0 migrator/v1migrator_utils.go | 97 ------------------- 8 files changed, 198 deletions(-) delete mode 100644 migrator/migratorDataDB.go delete mode 100755 migrator/migratorStorDB.go rename migrator/{v1mongo_data.go => storage_mongo_datadb.go} (100%) rename migrator/{v1mongo_stor.go => storage_mongo_stordb.go} (100%) rename migrator/{v1redis.go => storage_redis.go} (100%) rename migrator/{v1sql.go => storage_sql.go} (100%) delete mode 100644 migrator/v1migrator_utils.go diff --git a/migrator/migratorDataDB.go b/migrator/migratorDataDB.go deleted file mode 100644 index 3b38840e3..000000000 --- a/migrator/migratorDataDB.go +++ /dev/null @@ -1,45 +0,0 @@ -/* -Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments -Copyright (C) ITsysCOM GmbH - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see -*/ - -package migrator - -import ( - "github.com/cgrates/cgrates/engine" -) - -type MigratorDataDB interface { - getv1Account() (v1Acnt *v1Account, err error) - setV1Account(x *v1Account) (err error) - getV1ActionPlans() (v1aps *v1ActionPlans, err error) - setV1ActionPlans(x *v1ActionPlans) (err error) - getV1Actions() (v1acs *v1Actions, err error) - setV1Actions(x *v1Actions) (err error) - getV1ActionTriggers() (v1acts *v1ActionTriggers, err error) - setV1ActionTriggers(x *v1ActionTriggers) (err error) - getV1SharedGroup() (v1acts *v1SharedGroup, err error) - setV1SharedGroup(x *v1SharedGroup) (err error) - getV1Stats() (v1st *v1Stat, err error) - setV1Stats(x *v1Stat) (err error) - getV2ActionTrigger() (v2at *v2ActionTrigger, err error) - setV2ActionTrigger(x *v2ActionTrigger) (err error) - getv2Account() (v2Acnt *v2Account, err error) - setV2Account(x *v2Account) (err error) - getV1AttributeProfile() (v1attrPrf *v1AttributeProfile, err error) - setV1AttributeProfile(x *v1AttributeProfile) (err error) - DataManager() *engine.DataManager -} diff --git a/migrator/migratorStorDB.go b/migrator/migratorStorDB.go deleted file mode 100755 index 508632220..000000000 --- a/migrator/migratorStorDB.go +++ /dev/null @@ -1,34 +0,0 @@ -/* -Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments -Copyright (C) ITsysCOM GmbH - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see -*/ - -package migrator - -import ( - "github.com/cgrates/cgrates/engine" -) - -type MigratorStorDB interface { - getV1CDR() (v1Cdr *v1Cdrs, err error) - setV1CDR(v1Cdr *v1Cdrs) (err error) - createV1SMCosts() (err error) - renameV1SMCosts() (err error) - getV2SMCost() (v2Cost *v2SessionsCost, err error) - setV2SMCost(v2Cost *v2SessionsCost) (err error) - remV2SMCost(v2Cost *v2SessionsCost) (err error) - StorDB() engine.StorDB -} diff --git a/migrator/migrator_utils.go b/migrator/migrator_utils.go index 330eb67d3..50892c3e5 100644 --- a/migrator/migrator_utils.go +++ b/migrator/migrator_utils.go @@ -73,25 +73,3 @@ func NewMigratorStorDB(db_type, host, port, name, user, pass string, } return d, nil } - -/* - -func ConfigureV1StorDB(db_type, host, port, name, user, pass string) (db MigratorStorDB, err error) { - var d MigratorStorDB - switch db_type { - case utils.MONGO: - d, err = newv1MongoStorage(host, port, name, user, pass, utils.StorDB, nil) - db = d.(MigratorStorDB) - case utils.MYSQL: - d, err = newSqlStorage(host, port, name, user, pass) - db = d.(MigratorStorDB) - default: - err = errors.New(fmt.Sprintf("Unknown db '%s' valid options are '%s'", - db_type, utils.MONGO)) - } - if err != nil { - return nil, err - } - return d, nil -} -*/ diff --git a/migrator/v1mongo_data.go b/migrator/storage_mongo_datadb.go similarity index 100% rename from migrator/v1mongo_data.go rename to migrator/storage_mongo_datadb.go diff --git a/migrator/v1mongo_stor.go b/migrator/storage_mongo_stordb.go similarity index 100% rename from migrator/v1mongo_stor.go rename to migrator/storage_mongo_stordb.go diff --git a/migrator/v1redis.go b/migrator/storage_redis.go similarity index 100% rename from migrator/v1redis.go rename to migrator/storage_redis.go diff --git a/migrator/v1sql.go b/migrator/storage_sql.go similarity index 100% rename from migrator/v1sql.go rename to migrator/storage_sql.go diff --git a/migrator/v1migrator_utils.go b/migrator/v1migrator_utils.go deleted file mode 100644 index 330eb67d3..000000000 --- a/migrator/v1migrator_utils.go +++ /dev/null @@ -1,97 +0,0 @@ -/* -Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments -Copyright (C) ITsysCOM GmbH - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see -*/ - -package migrator - -import ( - "errors" - "fmt" - - "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/engine" - "github.com/cgrates/cgrates/utils" -) - -func NewMigratorDataDB(db_type, host, port, name, user, pass, marshaler string, - cacheCfg config.CacheConfig, loadHistorySize int) (db MigratorDataDB, err error) { - dm, err := engine.ConfigureDataStorage(db_type, - host, port, name, user, pass, marshaler, - cacheCfg, loadHistorySize) - var d MigratorDataDB - if err != nil { - return nil, err - } - switch db_type { - case utils.REDIS: - d = newRedisMigrator(dm) - case utils.MONGO: - d = newMongoMigrator(dm) - db = d.(MigratorDataDB) - default: - err = errors.New(fmt.Sprintf("Unknown db '%s' valid options are '%s' or '%s'", - db_type, utils.REDIS, utils.MONGO)) - } - return d, nil -} - -func NewMigratorStorDB(db_type, host, port, name, user, pass string, - maxConn, maxIdleConn, connMaxLifetime int, cdrsIndexes []string) (db MigratorStorDB, err error) { - var d MigratorStorDB - storDb, err := engine.ConfigureStorDB(db_type, host, port, name, user, pass, - maxConn, maxIdleConn, connMaxLifetime, cdrsIndexes) - if err != nil { - return nil, err - } - switch db_type { - case utils.MONGO: - d = newMongoStorDBMigrator(storDb) - db = d.(MigratorStorDB) - case utils.MYSQL: - d = newMigratorSQL(storDb) - db = d.(MigratorStorDB) - case utils.POSTGRES: - d = newMigratorSQL(storDb) - db = d.(MigratorStorDB) - default: - err = errors.New(fmt.Sprintf("Unknown db '%s' valid options are '%s' or '%s'", - db_type, utils.MONGO, utils.MYSQL)) - } - return d, nil -} - -/* - -func ConfigureV1StorDB(db_type, host, port, name, user, pass string) (db MigratorStorDB, err error) { - var d MigratorStorDB - switch db_type { - case utils.MONGO: - d, err = newv1MongoStorage(host, port, name, user, pass, utils.StorDB, nil) - db = d.(MigratorStorDB) - case utils.MYSQL: - d, err = newSqlStorage(host, port, name, user, pass) - db = d.(MigratorStorDB) - default: - err = errors.New(fmt.Sprintf("Unknown db '%s' valid options are '%s'", - db_type, utils.MONGO)) - } - if err != nil { - return nil, err - } - return d, nil -} -*/