mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Add SetStatQueueProfile in Datamanager
This commit is contained in:
committed by
Dan Christian Bogos
parent
55f7ad1151
commit
e4ae3e0a28
@@ -43,7 +43,7 @@ func (apierV1 *ApierV1) SetStatQueueProfile(sqp *engine.StatQueueProfile, reply
|
||||
if missing := utils.MissingStructFields(sqp, []string{"Tenant", "ID"}); len(missing) != 0 {
|
||||
return utils.NewErrMandatoryIeMissing(missing...)
|
||||
}
|
||||
if err := apierV1.DataManager.DataDB().SetStatQueueProfile(sqp); err != nil {
|
||||
if err := apierV1.DataManager.SetStatQueueProfile(sqp); err != nil {
|
||||
return utils.APIErrorHandler(err)
|
||||
}
|
||||
cache.RemKey(utils.StatQueueProfilePrefix+utils.ConcatenatedKey(sqp.Tenant, sqp.ID),
|
||||
|
||||
@@ -201,3 +201,7 @@ func (dm *DataManager) GetStatQueueProfile(tenant, id string, skipCache bool, tr
|
||||
cache.Set(key, sqp, cacheCommit(transactionID), transactionID)
|
||||
return
|
||||
}
|
||||
|
||||
func (dm *DataManager) SetStatQueueProfile(sqp *StatQueueProfile) (err error) {
|
||||
return dm.DataDB().SetStatQueueProfileDrv(sqp)
|
||||
}
|
||||
|
||||
@@ -1980,7 +1980,7 @@ func testOnStorITCRUDStatQueueProfile(t *testing.T) {
|
||||
if _, ok := cache.Get(utils.StatQueueProfilePrefix + sq.ID); ok != false {
|
||||
t.Error("Should not be in cache")
|
||||
}
|
||||
if err := onStor.DataDB().SetStatQueueProfile(sq); err != nil {
|
||||
if err := onStor.SetStatQueueProfile(sq); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if _, ok := cache.Get(utils.StatQueueProfilePrefix + sq.ID); ok != false {
|
||||
|
||||
@@ -115,7 +115,7 @@ type DataDB interface {
|
||||
SetReqFilterIndexes(dbKey string, indexes map[string]map[string]utils.StringMap) (err error)
|
||||
MatchReqFilterIndex(dbKey, fieldName, fieldVal string) (itemIDs utils.StringMap, err error)
|
||||
GetStatQueueProfileDrv(tenant string, ID string) (sq *StatQueueProfile, err error)
|
||||
SetStatQueueProfile(sq *StatQueueProfile) (err error)
|
||||
SetStatQueueProfileDrv(sq *StatQueueProfile) (err error)
|
||||
RemStatQueueProfile(tenant, id, transactionID string) (err error)
|
||||
GetStoredStatQueue(tenant, id string) (sq *StoredStatQueue, err error)
|
||||
SetStoredStatQueue(sq *StoredStatQueue) (err error)
|
||||
|
||||
@@ -1504,8 +1504,8 @@ func (ms *MapStorage) GetStatQueueProfileDrv(tenant string, id string) (sq *Stat
|
||||
return
|
||||
}
|
||||
|
||||
// SetStatsQueue stores a StatsQueue into DataDB
|
||||
func (ms *MapStorage) SetStatQueueProfile(sqp *StatQueueProfile) (err error) {
|
||||
// SetStatsQueueDrv stores a StatsQueue into DataDB
|
||||
func (ms *MapStorage) SetStatQueueProfileDrv(sqp *StatQueueProfile) (err error) {
|
||||
ms.mu.Lock()
|
||||
defer ms.mu.Unlock()
|
||||
result, err := ms.ms.Marshal(sqp)
|
||||
|
||||
@@ -2092,8 +2092,8 @@ func (ms *MongoStorage) GetStatQueueProfileDrv(tenant string, id string) (sq *St
|
||||
return
|
||||
}
|
||||
|
||||
// SetStatsQueue stores a StatsQueue into DataDB
|
||||
func (ms *MongoStorage) SetStatQueueProfile(sq *StatQueueProfile) (err error) {
|
||||
// SetStatsQueueDrv stores a StatsQueue into DataDB
|
||||
func (ms *MongoStorage) SetStatQueueProfileDrv(sq *StatQueueProfile) (err error) {
|
||||
session, col := ms.conn(colSqp)
|
||||
defer session.Close()
|
||||
_, err = col.UpsertId(bson.M{"tennat": sq.Tenant, "id": sq.ID}, sq)
|
||||
|
||||
@@ -1599,7 +1599,7 @@ func (rs *RedisStorage) RemoveVersions(vrs Versions) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
// GetStatQueueProfile retrieves a StatQueueProfile from dataDB
|
||||
// GetStatQueueProfileDrv retrieves a StatQueueProfile from dataDB
|
||||
func (rs *RedisStorage) GetStatQueueProfileDrv(tenant string, id string) (sq *StatQueueProfile, err error) {
|
||||
key := utils.StatQueueProfilePrefix + utils.ConcatenatedKey(tenant, id)
|
||||
var values []byte
|
||||
@@ -1620,8 +1620,8 @@ func (rs *RedisStorage) GetStatQueueProfileDrv(tenant string, id string) (sq *St
|
||||
return
|
||||
}
|
||||
|
||||
// SetStatsQueue stores a StatsQueue into DataDB
|
||||
func (rs *RedisStorage) SetStatQueueProfile(sq *StatQueueProfile) (err error) {
|
||||
// SetStatsQueueDrv stores a StatsQueue into DataDB
|
||||
func (rs *RedisStorage) SetStatQueueProfileDrv(sq *StatQueueProfile) (err error) {
|
||||
var result []byte
|
||||
result, err = rs.ms.Marshal(sq)
|
||||
if err != nil {
|
||||
|
||||
@@ -2049,7 +2049,7 @@ func (tpr *TpReader) WriteToDatabase(flush, verbose, disable_reverse bool) (err
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err = tpr.dm.DataDB().SetStatQueueProfile(st); err != nil {
|
||||
if err = tpr.dm.SetStatQueueProfile(st); err != nil {
|
||||
return err
|
||||
}
|
||||
if verbose {
|
||||
|
||||
Reference in New Issue
Block a user