Small fix

This commit is contained in:
edwardro22
2017-09-07 16:19:54 +00:00
parent 41bc52ca97
commit eb9e282969
9 changed files with 3 additions and 200 deletions

View File

@@ -70,7 +70,7 @@ var (
dbDataEncoding = flag.String("dbdata_encoding", config.CgrConfig().DBDataEncoding, "The encoding used to store object data in strings")
oldDBDataEncoding = flag.String("old_dbdata_encoding", "", "The encoding used to store object data in strings")
//nu salvez doar citesc din oldDb
//TO DO:
//dryRun = flag.Bool("dry_run", false, "When true will not save loaded data to dataDb but just parse it for consistency and errors.")
//verbose = flag.Bool("verbose", false, "Enable detailed verbose logging output")
//slice mapstring int cate acc [0]am citit si [1]cate acc am scris

View File

@@ -19,11 +19,9 @@ package migrator
import (
"fmt"
// /"log"
"github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/utils"
//"gopkg.in/mgo.v2/bson"
)
type v1Action struct {

View File

@@ -26,10 +26,6 @@ import (
"github.com/cgrates/cgrates/utils"
)
// const (
// v1AccountDBPrefix = "ubl_"
// )
type v1ActionPlan struct {
Uuid string // uniquely identify the timing
Id string // informative purpose only

View File

@@ -12,7 +12,6 @@ import (
type v1ActionTrigger struct {
Id string // for visual identification
ThresholdType string //*min_counter, *max_counter, *min_balance, *max_balance
// stats: *min_asr, *max_asr, *min_acd, *max_acd, *min_tcd, *max_tcd, *min_acc, *max_acc, *min_tcc, *max_tcc
ThresholdValue float64
Recurrent bool // reset eexcuted flag each run
MinSleep time.Duration // Minimum duration between two executions in case of recurrent triggers

View File

@@ -50,24 +50,4 @@ func ConfigureV1DataStorage(db_type, host, port, name, user, pass, marshaler str
return nil, err
}
return d, nil
}
// func ConfigureV1Storage(db_type, host, port, name, user, pass, marshaler string) (db v1StorDB, err error) {
// func ConfigureStorStorage(db_type, host, port, name, user, pass, marshaler string, maxConn, maxIdleConn, connMaxLifetime int, cdrsIndexes []string) (db Storage, err error) {
// var d Storage
// switch db_type {
// case utils.MONGO:
// d, err = newv1MongoStorage(host, port, name, user, pass, utils.StorDB, cdrsIndexes, nil, 1)
// case utils.POSTGRES:
// d, err = NewPostgresStorage(host, port, name, user, pass, maxConn, maxIdleConn, connMaxLifetime)
// case utils.MYSQL:
// d, err = NewMySQLStorage(host, port, name, user, pass, maxConn, maxIdleConn, connMaxLifetime)
// default:
// err = errors.New(fmt.Sprintf("Unknown db '%s' valid options are [%s, %s, %s]",
// db_type, utils.MYSQL, utils.MONGO, utils.POSTGRES))
// }
// if err != nil {
// return nil, err
// }
// return d, nil
// }
}

View File

@@ -1,25 +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 <http://www.gnu.org/licenses/>
*/
package migrator
// import (
// "github.com/cgrates/cgrates/utils"
// )
// getV1CallCost() (v1CC *v1CallCost, err error){
// return utils.ErrNotImplemented
// }

View File

@@ -1,123 +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 <http://www.gnu.org/licenses/>
*/
package migrator
// import (
// "fmt"
// "time"
// _ "github.com/go-sql-driver/mysql"
// "github.com/cgrates/cgrates/utils"
// "github.com/jinzhu/gorm"
// _ "github.com/lib/pq"
// )
// type v1SQLStorage struct {
// Db *sql.DB
// db *gorm.DB
// Storsql
// }
// func NewPostgresStorage(host, port, name, user, password string, maxConn, maxIdleConn, connMaxLifetime int) (*v1SQLStorage, error) {
// connectString := fmt.Sprintf("host=%s port=%s dbname=%s user=%s password=%s sslmode=disable", host, port, name, user, password)
// db, err := gorm.Open("postgres", connectString)
// if err != nil {
// return nil, err
// }
// err = db.DB().Ping()
// if err != nil {
// return nil, err
// }
// db.DB().SetMaxIdleConns(maxIdleConn)
// db.DB().SetMaxOpenConns(maxConn)
// db.DB().SetConnMaxLifetime(time.Duration(connMaxLifetime) * time.Second)
// //db.LogMode(true)
// postgressStorage := new(PostgresStorage)
// postgressStorage.db = db
// postgressStorage.Db = db.DB()
// return &SQLStorage{db.DB(), db, postgressStorage, postgressStorage}, nil
// }
// func NewMySQLStorage(host, port, name, user, password string, maxConn, maxIdleConn, connMaxLifetime int) (*v1SQLStorage, error) {
// connectString := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8&loc=Local&parseTime=true", user, password, host, port, name)
// db, err := gorm.Open("mysql", connectString)
// if err != nil {
// return nil, err
// }
// if err = db.DB().Ping(); err != nil {
// return nil, err
// }
// db.DB().SetMaxIdleConns(maxIdleConn)
// db.DB().SetMaxOpenConns(maxConn)
// db.DB().SetConnMaxLifetime(time.Duration(connMaxLifetime) * time.Second)
// //db.LogMode(true)
// mySQLStorage := new(MySQLStorage)
// mySQLStorage.db = db
// mySQLStorage.Db = db.DB()
// return &SQLStorage{db.DB(), db, mySQLStorage, mySQLStorage}, nil
// }
// getV1CallCost() (v1CC *v1CallCost, err error){
// //echivalentu la ce am facut la mongo doar ca cu rows
// var storSQL *sql.DB
// switch m.storDBType {
// case utils.MYSQL:
// storSQL = m.storDB.(*engine.SQLStorage).Db
// case utils.POSTGRES:
// storSQL = m.storDB.(*engine.PostgresStorage).Db
// default:
// return utils.NewCGRError(utils.Migrator,
// utils.MandatoryIEMissingCaps,
// utils.UnsupportedDB,
// fmt.Sprintf("unsupported database type: <%s>", m.storDBType))
// }
// rows, err := storSQL.Query("SELECT id, tor, direction, tenant, category, account, subject, destination, cost, cost_details FROM cdrs")
// if err != nil {
// return utils.NewCGRError(utils.Migrator,
// utils.ServerErrorCaps,
// err.Error(),
// fmt.Sprintf("error: <%s> when querying storDB for cdrs", err.Error()))
// }
// defer rows.Close()
// for cnt := 0; rows.Next(); cnt++ {
// var id int64
// var ccDirection, ccCategory, ccTenant, ccSubject, ccAccount, ccDestination, ccTor sql.NullString
// var ccCost sql.NullFloat64
// var tts []byte
// if err := rows.Scan(&id, &ccTor, &ccDirection, &ccTenant, &ccCategory, &ccAccount, &ccSubject, &ccDestination, &ccCost, &tts); err != nil {
// return utils.NewCGRError(utils.Migrator,
// utils.ServerErrorCaps,
// err.Error(),
// fmt.Sprintf("error: <%s> when scanning at count: <%d>", err.Error(), cnt))
// }
// var v1tmsps v1TimeSpans
// if err := json.Unmarshal(tts, &v1tmsps); err != nil {
// utils.Logger.Warning(
// fmt.Sprintf("<Migrator> Unmarshalling timespans at CDR with id: <%d>, error: <%s>", id, err.Error()))
// continue
// }
// return v1CC := &v1CallCost{Direction: ccDirection.String, Category: ccCategory.String, Tenant: ccTenant.String,
// Subject: ccSubject.String, Account: ccAccount.String, Destination: ccDestination.String, TOR: ccTor.String,
// Cost: ccCost.Float64, Timespans: v1tmsps}
// }
// }

View File

@@ -1,22 +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 <http://www.gnu.org/licenses/>
*/
package migrator
// type v1StorDB interface {
// getV1CallCost() (v1CC *v1CallCost, err error)
// }

View File

@@ -23,7 +23,7 @@ import (
)
var (
ErrNoMoreData = errors.New("NO_MORE_DATA")
ErrNoMoreData = errors.New("no more data")
ErrNotImplemented = errors.New("NOT_IMPLEMENTED")
ErrNotFound = errors.New("NOT_FOUND")
ErrTimedOut = errors.New("TIMED_OUT")