mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Rename Get/Set/Rem StoredStatQueue -> Get/Set/Rem StoredStatQueueDrv
This commit is contained in:
committed by
Dan Christian Bogos
parent
2c9fb56821
commit
2cad9cfc8f
@@ -237,7 +237,7 @@ func (dm *DataManager) GetStatQueue(tenant, id string, skipCache bool, transacti
|
||||
return x.(*StatQueue), nil
|
||||
}
|
||||
}
|
||||
ssq, err := dm.dataDB.GetStoredStatQueue(tenant, id)
|
||||
ssq, err := dm.dataDB.GetStoredStatQueueDrv(tenant, id)
|
||||
if err != nil {
|
||||
if err == utils.ErrNotFound {
|
||||
cache.Set(key, nil, cacheCommit(transactionID), transactionID)
|
||||
@@ -257,12 +257,12 @@ func (dm *DataManager) SetStatQueue(sq *StatQueue) (err error) {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return dm.dataDB.SetStoredStatQueue(ssq)
|
||||
return dm.dataDB.SetStoredStatQueueDrv(ssq)
|
||||
}
|
||||
|
||||
// RemStatQueue removes the StoredStatQueue and clears the cache for StatQueue
|
||||
func (dm *DataManager) RemStatQueue(tenant, id string, transactionID string) (err error) {
|
||||
if err = dm.dataDB.RemStoredStatQueue(tenant, id); err != nil {
|
||||
if err = dm.dataDB.RemStoredStatQueueDrv(tenant, id); err != nil {
|
||||
return
|
||||
}
|
||||
cache.RemKey(utils.StatQueuePrefix+utils.ConcatenatedKey(tenant, id), cacheCommit(transactionID), transactionID)
|
||||
|
||||
@@ -2025,18 +2025,18 @@ func testOnStorITCRUDStoredStatQueue(t *testing.T) {
|
||||
utils.MetaASR: msrshled,
|
||||
},
|
||||
}
|
||||
if err := onStor.DataDB().SetStoredStatQueue(sq); err != nil {
|
||||
if err := onStor.DataDB().SetStoredStatQueueDrv(sq); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if rcv, err := onStor.DataDB().GetStoredStatQueue(sq.Tenant, sq.ID); err != nil {
|
||||
if rcv, err := onStor.DataDB().GetStoredStatQueueDrv(sq.Tenant, sq.ID); err != nil {
|
||||
t.Error(err)
|
||||
} else if !reflect.DeepEqual(sq, rcv) {
|
||||
t.Errorf("Expecting: %v, received: %v", sq, rcv)
|
||||
}
|
||||
if err := onStor.DataDB().RemStoredStatQueue(sq.Tenant, sq.ID); err != nil {
|
||||
if err := onStor.DataDB().RemStoredStatQueueDrv(sq.Tenant, sq.ID); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if _, rcvErr := onStor.DataDB().GetStoredStatQueue(sq.Tenant, sq.ID); rcvErr != utils.ErrNotFound {
|
||||
if _, rcvErr := onStor.DataDB().GetStoredStatQueueDrv(sq.Tenant, sq.ID); rcvErr != utils.ErrNotFound {
|
||||
t.Error(rcvErr)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,9 +116,9 @@ type DataDB interface {
|
||||
GetStatQueueProfileDrv(tenant string, ID string) (sq *StatQueueProfile, err error)
|
||||
SetStatQueueProfileDrv(sq *StatQueueProfile) (err error)
|
||||
RemStatQueueProfileDrv(tenant, id string) (err error)
|
||||
GetStoredStatQueue(tenant, id string) (sq *StoredStatQueue, err error)
|
||||
SetStoredStatQueue(sq *StoredStatQueue) (err error)
|
||||
RemStoredStatQueue(tenant, id string) (err error)
|
||||
GetStoredStatQueueDrv(tenant, id string) (sq *StoredStatQueue, err error)
|
||||
SetStoredStatQueueDrv(sq *StoredStatQueue) (err error)
|
||||
RemStoredStatQueueDrv(tenant, id string) (err error)
|
||||
GetThresholdProfileDrv(tenant string, ID string) (tp *ThresholdProfile, err error)
|
||||
SetThresholdProfileDrv(tp *ThresholdProfile) (err error)
|
||||
RemThresholdProfileDrv(tenant, id string) (err error)
|
||||
|
||||
@@ -1242,7 +1242,7 @@ func (ms *MapStorage) RemStatQueueProfileDrv(tenant, id string) (err error) {
|
||||
}
|
||||
|
||||
// GetStatQueue retrieves the stored metrics for a StatsQueue
|
||||
func (ms *MapStorage) GetStoredStatQueue(tenant, id string) (sq *StoredStatQueue, err error) {
|
||||
func (ms *MapStorage) GetStoredStatQueueDrv(tenant, id string) (sq *StoredStatQueue, err error) {
|
||||
ms.mu.RLock()
|
||||
defer ms.mu.RUnlock()
|
||||
values, ok := ms.dict[utils.StatQueuePrefix+utils.ConcatenatedKey(tenant, id)]
|
||||
@@ -1254,7 +1254,7 @@ func (ms *MapStorage) GetStoredStatQueue(tenant, id string) (sq *StoredStatQueue
|
||||
}
|
||||
|
||||
// SetStatQueue stores the metrics for a StatsQueue
|
||||
func (ms *MapStorage) SetStoredStatQueue(sq *StoredStatQueue) (err error) {
|
||||
func (ms *MapStorage) SetStoredStatQueueDrv(sq *StoredStatQueue) (err error) {
|
||||
ms.mu.Lock()
|
||||
defer ms.mu.Unlock()
|
||||
var result []byte
|
||||
@@ -1267,7 +1267,7 @@ func (ms *MapStorage) SetStoredStatQueue(sq *StoredStatQueue) (err error) {
|
||||
}
|
||||
|
||||
// RemStatQueue removes a StatsQueue
|
||||
func (ms *MapStorage) RemStoredStatQueue(tenant, id string) (err error) {
|
||||
func (ms *MapStorage) RemStoredStatQueueDrv(tenant, id string) (err error) {
|
||||
ms.mu.Lock()
|
||||
defer ms.mu.Unlock()
|
||||
delete(ms.dict, utils.StatQueuePrefix+utils.ConcatenatedKey(tenant, id))
|
||||
|
||||
@@ -1842,7 +1842,7 @@ func (ms *MongoStorage) RemStatQueueProfileDrv(tenant, id string) (err error) {
|
||||
}
|
||||
|
||||
// GetStoredStatQueue retrieves a StoredStatQueue
|
||||
func (ms *MongoStorage) GetStoredStatQueue(tenant, id string) (sq *StoredStatQueue, err error) {
|
||||
func (ms *MongoStorage) GetStoredStatQueueDrv(tenant, id string) (sq *StoredStatQueue, err error) {
|
||||
session, col := ms.conn(colSqs)
|
||||
defer session.Close()
|
||||
if err = col.Find(bson.M{"tenant": tenant, "id": id}).One(&sq); err != nil {
|
||||
@@ -1855,7 +1855,7 @@ func (ms *MongoStorage) GetStoredStatQueue(tenant, id string) (sq *StoredStatQue
|
||||
}
|
||||
|
||||
// SetStoredStatQueue stores the metrics for a StoredStatQueue
|
||||
func (ms *MongoStorage) SetStoredStatQueue(sq *StoredStatQueue) (err error) {
|
||||
func (ms *MongoStorage) SetStoredStatQueueDrv(sq *StoredStatQueue) (err error) {
|
||||
session, col := ms.conn(colSqs)
|
||||
defer session.Close()
|
||||
_, err = col.Upsert(bson.M{"tenant": sq.Tenant, "id": sq.ID}, sq)
|
||||
@@ -1863,7 +1863,7 @@ func (ms *MongoStorage) SetStoredStatQueue(sq *StoredStatQueue) (err error) {
|
||||
}
|
||||
|
||||
// RemStatQueue removes stored metrics for a StoredStatQueue
|
||||
func (ms *MongoStorage) RemStoredStatQueue(tenant, id string) (err error) {
|
||||
func (ms *MongoStorage) RemStoredStatQueueDrv(tenant, id string) (err error) {
|
||||
session, col := ms.conn(colSqs)
|
||||
defer session.Close()
|
||||
err = col.Remove(bson.M{"tenant": tenant, "id": id})
|
||||
|
||||
@@ -1387,7 +1387,7 @@ func (rs *RedisStorage) RemStatQueueProfileDrv(tenant, id string) (err error) {
|
||||
}
|
||||
|
||||
// GetStoredStatQueue retrieves the stored metrics for a StatsQueue
|
||||
func (rs *RedisStorage) GetStoredStatQueue(tenant, id string) (sq *StoredStatQueue, err error) {
|
||||
func (rs *RedisStorage) GetStoredStatQueueDrv(tenant, id string) (sq *StoredStatQueue, err error) {
|
||||
key := utils.StatQueuePrefix + utils.ConcatenatedKey(tenant, id)
|
||||
var values []byte
|
||||
if values, err = rs.Cmd("GET", key).Bytes(); err != nil {
|
||||
@@ -1403,7 +1403,7 @@ func (rs *RedisStorage) GetStoredStatQueue(tenant, id string) (sq *StoredStatQue
|
||||
}
|
||||
|
||||
// SetStoredStatQueue stores the metrics for a StatsQueue
|
||||
func (rs *RedisStorage) SetStoredStatQueue(sq *StoredStatQueue) (err error) {
|
||||
func (rs *RedisStorage) SetStoredStatQueueDrv(sq *StoredStatQueue) (err error) {
|
||||
var result []byte
|
||||
result, err = rs.ms.Marshal(sq)
|
||||
if err != nil {
|
||||
@@ -1413,7 +1413,7 @@ func (rs *RedisStorage) SetStoredStatQueue(sq *StoredStatQueue) (err error) {
|
||||
}
|
||||
|
||||
// RemStatQueue removes a StatsQueue
|
||||
func (rs *RedisStorage) RemStoredStatQueue(tenant, id string) (err error) {
|
||||
func (rs *RedisStorage) RemStoredStatQueueDrv(tenant, id string) (err error) {
|
||||
key := utils.StatQueuePrefix + utils.ConcatenatedKey(tenant, id)
|
||||
if err = rs.Cmd("DEL", key).Err; err != nil {
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user