mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-12 02:26:26 +05:00
Updated DispatcherS with gob encoding
This commit is contained in:
committed by
Dan Christian Bogos
parent
a7eb087660
commit
b86fcd8c0d
@@ -33,32 +33,47 @@ var Cache *CacheS
|
||||
|
||||
func init() {
|
||||
Cache = NewCacheS(config.CgrConfig(), nil)
|
||||
//Threshold
|
||||
// Threshold
|
||||
gob.Register(new(Threshold))
|
||||
gob.Register(new(ThresholdProfile))
|
||||
gob.Register(new(ThresholdProfileWithArgDispatcher))
|
||||
gob.Register(new(ThresholdWithArgDispatcher))
|
||||
//Resource
|
||||
// Resource
|
||||
gob.Register(new(Resource))
|
||||
gob.Register(new(ResourceProfile))
|
||||
gob.Register(new(ResourceProfileWithArgDispatcher))
|
||||
gob.Register(new(ResourceWithArgDispatcher))
|
||||
//Stats
|
||||
// Stats
|
||||
gob.Register(new(StatQueue))
|
||||
gob.Register(new(StatQueueProfile))
|
||||
gob.Register(new(StatQueueProfileWithArgDispatcher))
|
||||
gob.Register(new(StoredStatQueue))
|
||||
gob.Register(new(StatQueueProfileWithArgDispatcher))
|
||||
//Suppliers
|
||||
// Suppliers
|
||||
gob.Register(new(SupplierProfile))
|
||||
gob.Register(new(SupplierProfileWithArgDispatcher))
|
||||
//Filters
|
||||
// Filters
|
||||
gob.Register(new(Filter))
|
||||
gob.Register(new(FilterWithArgDispatcher))
|
||||
//Dispatcher
|
||||
// Dispatcher
|
||||
gob.Register(new(DispatcherHost))
|
||||
gob.Register(new(DispatcherHostProfile))
|
||||
gob.Register(new(DispatcherHostWithArgDispatcher))
|
||||
|
||||
// CDRs
|
||||
gob.Register(new(EventCost))
|
||||
|
||||
// StatMetrics
|
||||
gob.Register(new(StatASR))
|
||||
gob.Register(new(StatACD))
|
||||
gob.Register(new(StatTCD))
|
||||
gob.Register(new(StatACC))
|
||||
gob.Register(new(StatTCC))
|
||||
gob.Register(new(StatPDD))
|
||||
gob.Register(new(StatDDC))
|
||||
gob.Register(new(StatSum))
|
||||
gob.Register(new(StatAverage))
|
||||
gob.Register(new(StatDistinct))
|
||||
}
|
||||
|
||||
//SetCache shared the cache from other subsystems
|
||||
|
||||
@@ -139,18 +139,30 @@ type SQItem struct {
|
||||
|
||||
// StatQueue represents an individual stats instance
|
||||
type StatQueue struct {
|
||||
sync.RWMutex // protect the elements from within
|
||||
Tenant string
|
||||
ID string
|
||||
SQItems []SQItem
|
||||
SQMetrics map[string]StatMetric
|
||||
MinItems int
|
||||
sqPrfl *StatQueueProfile
|
||||
dirty *bool // needs save
|
||||
ttl *time.Duration // timeToLeave, picked on each init
|
||||
lk sync.RWMutex // protect the elements from within
|
||||
Tenant string
|
||||
ID string
|
||||
SQItems []SQItem
|
||||
SQMetrics map[string]StatMetric
|
||||
MinItems int
|
||||
sqPrfl *StatQueueProfile
|
||||
dirty *bool // needs save
|
||||
ttl *time.Duration // timeToLeave, picked on each init
|
||||
}
|
||||
|
||||
// SqID will compose the unique identifier for the StatQueue out of Tenant and ID
|
||||
// RLock only to implement sync.RWMutex methods
|
||||
func (sq *StatQueue) RLock() { sq.lk.RLock() }
|
||||
|
||||
// RUnlock only to implement sync.RWMutex methods
|
||||
func (sq *StatQueue) RUnlock() { sq.lk.RUnlock() }
|
||||
|
||||
// Lock only to implement sync.RWMutex methods
|
||||
func (sq *StatQueue) Lock() { sq.lk.Lock() }
|
||||
|
||||
// Unlock only to implement sync.RWMutex methods
|
||||
func (sq *StatQueue) Unlock() { sq.lk.Unlock() }
|
||||
|
||||
// TenantID will compose the unique identifier for the StatQueue out of Tenant and ID
|
||||
func (sq *StatQueue) TenantID() string {
|
||||
return utils.ConcatenatedKey(sq.Tenant, sq.ID)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user