engine

package
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 30, 2026 License: AGPL-3.0 Imports: 71 Imported by: 80

Documentation

Index

Constants

View Source
const (
	// these might be better in the confs under optimizations section
	MIN_PREFIX_MATCH = 1
	FALLBACK_SUBJECT = utils.MetaAny
)
View Source
const (
	// Freswitch event property names
	FS_CDR_MAP            = "variables"
	FS_UUID               = "uuid" // -Unique ID for this call leg
	FS_CALL_DEST_NR       = "dialed_extension"
	FS_PARK_TIME          = "start_epoch"
	FS_SETUP_TIME         = "start_epoch"
	FS_ANSWER_TIME        = "answer_epoch"
	FS_HANGUP_TIME        = "end_epoch"
	FS_DURATION           = "billsec"
	FS_USERNAME           = "user_name"
	FS_CDR_SOURCE         = "freeswitch_json"
	FS_SIP_REQUSER        = "sip_req_user" // Apps like FusionPBX do not set dialed_extension, alternative being destination_number but that comes in customer profile, not in vars
	FS_PROGRESS_MEDIAMSEC = "progress_mediamsec"
	FS_PROGRESSMS         = "progressmsec"
	FsUsername            = "username"
	FsIPv4                = "FreeSWITCH-IPv4"
)
View Source
const (
	MINE_PREFIX           = "*mine_"
	STRATEGY_MINE_LOWEST  = "*mine_lowest"
	STRATEGY_MINE_HIGHEST = "*mine_highest"
	STRATEGY_MINE_RANDOM  = "*mine_random"
	STRATEGY_LOWEST       = "*lowest"
	STRATEGY_HIGHEST      = "*highest"
	STRATEGY_RANDOM       = "*random"
)
View Source
const (
	ColDst  = "destinations"
	ColRds  = "reverse_destinations"
	ColAct  = "actions"
	ColApl  = "action_plans"
	ColAAp  = "account_action_plans"
	ColTsk  = "tasks"
	ColAtr  = "action_triggers"
	ColRpl  = "rating_plans"
	ColRpf  = "rating_profiles"
	ColAcc  = "accounts"
	ColShg  = "shared_groups"
	ColLht  = "load_history"
	ColVer  = "versions"
	ColRsP  = "resource_profiles"
	ColIPp  = "ip_profiles"
	ColIndx = "indexes"
	ColTmg  = "timings"
	ColRes  = "resources"
	ColIPs  = "ips"
	ColSqs  = "statqueues"
	ColTrp  = "trend_profiles"
	ColTrd  = "trends"
	ColSqp  = "statqueue_profiles"
	ColRgp  = "ranking_profiles"
	ColRnk  = "rankings"
	ColTps  = "threshold_profiles"
	ColThs  = "thresholds"
	ColFlt  = "filters"
	ColRts  = "route_profiles"
	ColAttr = "attribute_profiles"
	ColCDRs = "cdrs"
	ColCpp  = "charger_profiles"
	ColDpp  = "dispatcher_profiles"
	ColDph  = "dispatcher_hosts"
	ColLID  = "load_ids"
	ColBkup = "sessions_backup"
)

Collection names in MongoDB.

View Source
const (
	FORMAT = "2006-1-2 15:04:05 MST"
)

Redis commands

Variables

View Source
var (
	CGRIDLow       = strings.ToLower(utils.CGRID)
	RunIDLow       = strings.ToLower(utils.RunID)
	OrderIDLow     = strings.ToLower(utils.OrderID)
	OriginHostLow  = strings.ToLower(utils.OriginHost)
	OriginIDLow    = strings.ToLower(utils.OriginID)
	ToRLow         = strings.ToLower(utils.ToR)
	CDRHostLow     = strings.ToLower(utils.OriginHost)
	CDRSourceLow   = strings.ToLower(utils.Source)
	RequestTypeLow = strings.ToLower(utils.RequestType)
	TenantLow      = strings.ToLower(utils.Tenant)
	CategoryLow    = strings.ToLower(utils.Category)
	AccountLow     = strings.ToLower(utils.AccountField)
	SubjectLow     = strings.ToLower(utils.Subject)
	SetupTimeLow   = strings.ToLower(utils.SetupTime)
	AnswerTimeLow  = strings.ToLower(utils.AnswerTime)
	CreatedAtLow   = strings.ToLower(utils.CreatedAt)
	UpdatedAtLow   = strings.ToLower(utils.UpdatedAt)
	UsageLow       = strings.ToLower(utils.Usage)
	DestinationLow = strings.ToLower(utils.Destination)
	CostLow        = strings.ToLower(utils.Cost)
	CostSourceLow  = strings.ToLower(utils.CostSource)
)

Functions

func AppendToMysqlDSNOpts added in v0.11.0

func AppendToMysqlDSNOpts(opts map[string]string) string

func AttributeProfileToAPI added in v0.11.0

func AttributeProfileToAPI(attrPrf *AttributeProfile) (tpAttr *utils.TPAttributeProfile)

func CachedDestHasPrefix

func CachedDestHasPrefix(destId, prefix string) bool

Reverse search in cache to see if prefix belongs to destination id

func CallCache added in v0.11.0

func CallCache(connMgr *ConnManager, cacheConns []string, caching string, args map[string][]string, cacheIDs []string, opts map[string]any, verbose bool, tenant string) (err error)

CallCache call the cache reload after data load

func ChargerProfileToAPI added in v0.11.0

func ChargerProfileToAPI(chargerPrf *ChargerProfile) (tpCharger *utils.TPChargerProfile)

func CheckFilter added in v0.11.0

func CheckFilter(fltr *Filter) (err error)

func CheckVersions

func CheckVersions(storage Storage) error

CheckVersions returns an error if the db needs migration.

func ComputeIndexes added in v0.11.0

func ComputeIndexes(dm *DataManager, tnt, ctx, idxItmType string, IDs *[]string,
	transactionID string, getFilters func(tnt, id, ctx string) (*[]string, error), newFltr *Filter) (indexes utils.StringSet, err error)

ComputeIndexes gets the indexes from the DB and ensure that the items are indexed getFilters returns a list of filters IDs for the given profile id

func CsvDump added in v0.11.0

func CsvDump(s any) ([]string, error)

CsvDump receive and interface and convert it to a slice of string

func DispatcherHostToAPI added in v0.11.0

func DispatcherHostToAPI(dph *DispatcherHost) (tpDPH *utils.TPDispatcherHost)

func DispatcherProfileToAPI added in v0.11.0

func DispatcherProfileToAPI(dpp *DispatcherProfile) (tpDPP *utils.TPDispatcherProfile)

func FilterToTPFilter

func FilterToTPFilter(f *Filter) (tpFltr *utils.TPFilterProfile)

func GetHTTPPstrTransport added in v0.11.0

func GetHTTPPstrTransport() *http.Transport

GetHTTPPstrTransport gets the http transport to be used by the HTTP Poster

func GetRevFltrIdxHealth added in v0.11.0

func GetRevFltrIdxHealth(dm *DataManager, fltrCache, revFltrIdxCache *ltcache.Cache, objCaches map[string]*ltcache.Cache) (rply map[string]*ReverseFilterIHReply, err error)

GetRevFltrIdxHealth will return all the broken indexes

func GetSentryPeer added in v0.11.0

func GetSentryPeer(val string, sentryPeerCfg *config.SentryPeerCfg, dataType string) (found bool, err error)

fail or pass the filter based on sentrypeer server response

func IPProfileToAPI added in v0.11.0

func IPProfileToAPI(ipp *IPProfile) *utils.TPIPProfile

func IsDynamicDPPath added in v0.11.0

func IsDynamicDPPath(path string) bool

IsDynamicDPPath check dynamic path with ~*stats, ~*resources, ~*accounts, ~*libphonenumber, ~*asm to not be indexed Used to determine if the rule will be indexed

func LoadAllDataDBToCache added in v0.11.0

func LoadAllDataDBToCache(dm *DataManager) (err error)

func MapTPAccountActions

func MapTPAccountActions(s []*utils.TPAccountActions) (map[string]*utils.TPAccountActions, error)

func MapTPActionTimings

func MapTPActionTimings(s []*utils.TPActionPlan) map[string][]*utils.TPActionTiming

func MapTPActionTriggers

func MapTPActionTriggers(s []*utils.TPActionTriggers) map[string][]*utils.TPActionTrigger

func MapTPActions

func MapTPActions(s []*utils.TPActions) map[string][]*utils.TPAction

func MapTPDestinationRates

func MapTPDestinationRates(s []*utils.TPDestinationRate) (map[string]*utils.TPDestinationRate, error)

func MapTPRates

func MapTPRates(s []*utils.TPRateRALs) (map[string]*utils.TPRateRALs, error)

func MapTPRatingPlanBindings

func MapTPRatingPlanBindings(s []*utils.TPRatingPlan) map[string][]*utils.TPRatingPlanBinding

func MapTPRatingProfiles

func MapTPRatingProfiles(s []*utils.TPRatingProfile) (map[string]*utils.TPRatingProfile, error)

func MapTPSharedGroup

func MapTPSharedGroup(s []*utils.TPSharedGroups) map[string][]*utils.TPSharedGroup

func MapTPTimings

func MapTPTimings(tps []*utils.ApierTPTiming) (map[string]*utils.TPTiming, error)

func MatchingItemIDsForEvent

func MatchingItemIDsForEvent(ev utils.MapStorage, stringFldIDs, prefixFldIDs, suffixFldIDs, existsFldIDs *[]string,
	dm *DataManager, cacheID, itemIDPrefix string, indexedSelects, nestedFields bool) (itemIDs utils.StringSet, err error)

MatchingItemIDsForEvent returns the list of item IDs matching fieldName/fieldValue for an event fieldIDs limits the fields which are checked against indexes helper on top of dataDB.GetIndexes, adding utils.MetaAny to list of fields queried

func NewCsvFile

func NewCsvFile() csvReaderCloser

func NewCsvString

func NewCsvString() csvReaderCloser

func NewRPCConnection added in v0.11.0

func NewRPCConnection(ctx *context.Context, cfg *config.RemoteHost, keyPath, certPath, caPath string, connAttempts, reconnects int,
	maxReconnectInterval, connectTimeout, replyTimeout time.Duration, internalConnChan chan birpc.ClientConnector, lazyConnect bool,
	poolID, connID string, connCache *ltcache.Cache) (client birpc.ClientConnector, err error)

NewRPCConnection creates a new connection based on the RemoteHost structure connCache is used to cache the connection with ID

func NewRPCPool

func NewRPCPool(ctx *context.Context, dispatchStrategy string, keyPath, certPath, caPath string, connAttempts, reconnects int,
	maxReconnectInterval, connectTimeout, replyTimeout time.Duration, rpcConnCfgs []*config.RemoteHost,
	internalConnChan chan birpc.ClientConnector, lazyConnect bool,
	poolID string, connCache *ltcache.Cache) (rpcPool *rpcclient.RPCPool, err error)

NewRPCPool returns a new pool of connection with the given configuration

func NewService added in v0.11.0

func NewService(rcvr any) (*birpc.Service, error)

func NewServiceWithName added in v0.11.0

func NewServiceWithName(rcvr any, name string, useName bool) (*birpc.Service, error)

func OverwriteDBVersions

func OverwriteDBVersions(storage Storage) (err error)

OverwriteDBVersions sets the version overwriting them

func ParseAttribute added in v0.11.0

func ParseAttribute(dp utils.DataProvider, attrType, path string, value config.RSRParsers, roundingDec int, timeZone, layout, rsrSep string) (
	out any, err error)

func RankingProfileToAPI added in v0.11.0

func RankingProfileToAPI(rg *RankingProfile) (tpRG *utils.TPRankingProfile)

func RegisterActionFunc added in v0.11.0

func RegisterActionFunc(action string, f actionTypeFunc)

func RegisterPingMethod added in v0.11.0

func RegisterPingMethod(methodMap map[string]*birpc.MethodType)

func ResourceProfileToAPI added in v0.11.0

func ResourceProfileToAPI(rp *ResourceProfile) (tpRL *utils.TPResourceProfile)

func RouteProfileToAPI added in v0.11.0

func RouteProfileToAPI(rp *RouteProfile) (tpRp *utils.TPRouteProfile)

func SetCdrStorage

func SetCdrStorage(cStorage CdrStorage)

SetCdrStorage sets the database for CDR storing, used by *cdrlog in first place

func SetConnManager

func SetConnManager(conMgr *ConnManager)

SetConnManager is the exported method to set the connectionManager used when operate on an account.

func SetDBVersions

func SetDBVersions(storage Storage) (err error)

SetDBVersions sets the version without overwriting them

func SetDataStorage

func SetDataStorage(dm2 *DataManager)

SetDataStorage is the exported method to set the storage getter.

func SetHTTPPstrTransport added in v0.11.0

func SetHTTPPstrTransport(pstrTransport *http.Transport)

SetHTTPPstrTransport sets the http transport to be used by the HTTP Poster

func SetRoundingDecimals

func SetRoundingDecimals(rd int)

SetRoundingDecimals sets the global rounding method and decimal precision for GetCost method

func SetRpSubjectPrefixMatching

func SetRpSubjectPrefixMatching(flag bool)

SetRpSubjectPrefixMatching sets rpSubjectPrefixMatching (is thread safe)

func StatQueueProfileToAPI added in v0.11.0

func StatQueueProfileToAPI(st *StatQueueProfile) (tpST *utils.TPStatProfile)

func SureTaxProcessCdr

func SureTaxProcessCdr(cdr *CDR) error

func ThresholdProfileToAPI added in v0.11.0

func ThresholdProfileToAPI(th *ThresholdProfile) (tpTH *utils.TPThresholdProfile)

func TrendProfileToAPI added in v0.11.0

func TrendProfileToAPI(tr *TrendProfile) (tpTR *utils.TPTrendsProfile)

func UpdateFilterIndex added in v0.11.0

func UpdateFilterIndex(dm *DataManager, oldFlt, newFlt *Filter) (err error)

UpdateFilterIndex will update the indexes for the new Filter we do not care what is added exported for the migrator

func UpdateReplicationFilters added in v0.10.3

func UpdateReplicationFilters(objType, objID, connID string)

UpdateReplicationFilters sets the connection ID in cache for filtered replication. It's a no-op if connID is empty.

func WeightFromDynamics added in v0.11.0

func WeightFromDynamics(dWs []*utils.DynamicWeight,
	fltrS *FilterS, tnt string, ev utils.DataProvider) (wg float64, err error)

Weight returns weight of the first matching DynamicWeight

Types

type APIAttributeProfile added in v0.11.0

type APIAttributeProfile struct {
	Tenant             string
	ID                 string
	Contexts           []string // bind this AttributeProfile to multiple contexts
	FilterIDs          []string
	ActivationInterval *utils.ActivationInterval // Activation interval
	Attributes         []*ExternalAttribute
	Blocker            bool // blocker flag to stop processing on multiple runs
	Weight             float64
}

APIAttributeProfile used by APIs

func (*APIAttributeProfile) AsAttributeProfile added in v0.11.0

func (ext *APIAttributeProfile) AsAttributeProfile() (attr *AttributeProfile, err error)

AsAttributeProfile converts the external attribute format to the actual AttributeProfile

type Account

type Account struct {
	ID             string
	BalanceMap     map[string]Balances
	UnitCounters   UnitCounters
	ActionTriggers ActionTriggers
	AllowNegative  bool
	Disabled       bool
	UpdateTime     time.Time
	// contains filtered or unexported fields
}

Account structure containing information about user's credit (minutes, cents, sms...).' This can represent a user or a shared group.

func (*Account) AsAccountSummary

func (acc *Account) AsAccountSummary() *AccountSummary

AsAccountSummary converts the account into AccountSummary

func (*Account) AsOldStructure

func (acc *Account) AsOldStructure() any

AsOldStructure used in some api for transition

func (*Account) CleanExpiredStuff

func (acc *Account) CleanExpiredStuff()

CleanExpiredStuff removed expired balances and actiontriggers

func (*Account) Clone

func (acc *Account) Clone() *Account

Clone creates a copy of the account

func (*Account) DebitConnectionFee

func (acc *Account) DebitConnectionFee(cc *CallCost, ufMoneyBalances Balances, count bool, block bool, fltrS *FilterS) (bool, Balance)

DebitConnectionFee debits the connection fee

func (*Account) ExecuteActionTriggers

func (acc *Account) ExecuteActionTriggers(a *Action, fltrS *FilterS)

ExecuteActionTriggers scans the action triggers and execute the actions for which trigger is met

func (*Account) FieldAsInterface added in v0.11.0

func (acc *Account) FieldAsInterface(fldPath []string) (val any, err error)

func (*Account) FieldAsString added in v0.11.0

func (acc *Account) FieldAsString(fldPath []string) (val string, err error)

func (*Account) FindBalanceByID added in v0.11.0

func (acc *Account) FindBalanceByID(balanceID string) (blnc *Balance, blncType string)

FindBalanceByID searches through all balance types for a balance with the specified ID and returns it alongside its type.

func (*Account) GetBalanceWithID

func (acc *Account) GetBalanceWithID(blcType, blcID string) (blc *Balance)

GetBalanceWithID returns a Balance given balance type and balance ID

func (*Account) GetDefaultMoneyBalance

func (acc *Account) GetDefaultMoneyBalance() *Balance

GetDefaultMoneyBalance returns the defaultmoney balance

func (*Account) GetID

func (acc *Account) GetID() string

GetID returns the account ID

func (*Account) GetSharedGroups

func (acc *Account) GetSharedGroups() (groups []string)

GetSharedGroups returns the shared groups that this user balance belnongs to

func (*Account) GetUniqueSharedGroupMembers

func (acc *Account) GetUniqueSharedGroupMembers(cd *CallDescriptor) (utils.StringMap, error)

GetUniqueSharedGroupMembers returns the acounts from the group

func (*Account) InitCounters

func (acc *Account) InitCounters()

InitCounters creates counters for all triggered actions

func (*Account) Publish

func (acc *Account) Publish(initBal map[string]float64)

Publish sends the account to stats and threshold

func (*Account) ResetActionTriggers

func (acc *Account) ResetActionTriggers(a *Action, fltrS *FilterS)

ResetActionTriggers marks all action trigers as ready for execution If the action is not nil it acts like a filter

func (*Account) SetRecurrent

func (acc *Account) SetRecurrent(a *Action, recurrent bool)

SetRecurrent sets/unsets recurrent flag for action triggers

func (*Account) SimulateConnectionFee added in v0.11.0

func (acc *Account) SimulateConnectionFee(cc *CallCost, ufMoneyBalances Balances, count bool, block bool, fltrS *FilterS) (bool, Balance)

SimulateConnectionFee simulates DebitConnectionFee without debiting

func (*Account) String added in v0.11.0

func (acc *Account) String() string

type AccountActionMdl added in v0.11.0

type AccountActionMdl struct {
	Id                int64
	Tpid              string
	Loadid            string
	Tenant            string `index:"0" re:".*"`
	Account           string `index:"1" re:".*"`
	ActionPlanTag     string `index:"2" re:".*"`
	ActionTriggersTag string `index:"3" re:".*"`
	AllowNegative     bool   `index:"4" re:".*"`
	Disabled          bool   `index:"5" re:".*"`
	CreatedAt         time.Time
}

func APItoModelAccountAction

func APItoModelAccountAction(aa *utils.TPAccountActions) *AccountActionMdl

func (*AccountActionMdl) GetAccountActionId added in v0.11.0

func (aa *AccountActionMdl) GetAccountActionId() string

func (*AccountActionMdl) SetAccountActionId added in v0.11.0

func (aa *AccountActionMdl) SetAccountActionId(id string) error

func (AccountActionMdl) TableName added in v0.11.0

func (AccountActionMdl) TableName() string

type AccountActionMdls added in v0.11.0

type AccountActionMdls []AccountActionMdl

func APItoModelAccountActions

func APItoModelAccountActions(aas []*utils.TPAccountActions) (result AccountActionMdls)

func (AccountActionMdls) AsMapTPAccountActions added in v0.11.0

func (tps AccountActionMdls) AsMapTPAccountActions() (map[string]*utils.TPAccountActions, error)

func (AccountActionMdls) AsTPAccountActions added in v0.11.0

func (tps AccountActionMdls) AsTPAccountActions() (result []*utils.TPAccountActions)

type AccountActionPlanIHReply added in v0.10.3

type AccountActionPlanIHReply struct {
	MissingAccountActionPlans map[string][]string // list of missing indexes for each object (the map has the key as the indexKey and a list of objects)
	BrokenReferences          map[string][]string // list of broken references (the map has the key as the objectID and a list of indexes)
}

func GetAccountActionPlansIndexHealth added in v0.10.3

func GetAccountActionPlansIndexHealth(dm *DataManager, objLimit, indexLimit int, objTTL, indexTTL time.Duration, objStaticTTL, indexStaticTTL bool) (rply *AccountActionPlanIHReply, err error)

add cache in args API

type AccountSummary

type AccountSummary struct {
	Tenant           string
	AccountID        string
	BalanceSummaries BalanceSummaries
	AllowNegative    bool
	Disabled         bool
}

AccountSummary contains compressed information about an Account

func NewAccountSummaryFromJSON

func NewAccountSummaryFromJSON(jsn string) (acntSummary *AccountSummary, err error)

NewAccountSummaryFromJSON creates a new AcccountSummary from a json string

func (*AccountSummary) AsMapInterface added in v0.11.0

func (as *AccountSummary) AsMapInterface() map[string]any

func (*AccountSummary) Clone

func (as *AccountSummary) Clone() (cln *AccountSummary)

Clone creates a copy of the structure

func (*AccountSummary) FieldAsInterface

func (as *AccountSummary) FieldAsInterface(fldPath []string) (val any, err error)

FieldAsInterface func to help EventCost FieldAsInterface

func (*AccountSummary) FieldAsString added in v0.11.0

func (as *AccountSummary) FieldAsString(fldPath []string) (val string, err error)

func (*AccountSummary) SetInitialValue added in v0.11.0

func (as *AccountSummary) SetInitialValue(old *AccountSummary)

SetInitialValue set initial balance value

func (*AccountSummary) String added in v0.11.0

func (as *AccountSummary) String() string

String implements utils.DataProvider

func (*AccountSummary) UpdateInitialValue added in v0.11.0

func (as *AccountSummary) UpdateInitialValue(old *AccountSummary)

UpdateInitialValue keeps the old initial balance value

type AccountWithAPIOpts added in v0.11.0

type AccountWithAPIOpts struct {
	*Account
	APIOpts map[string]any
}

type Accounting

type Accounting map[string]*BalanceCharge

Accounting the map of debited balances

func (Accounting) Clone

func (cbs Accounting) Clone() (cln Accounting)

Clone creates a copy of Accounting

func (Accounting) FieldAsInterface

func (cbs Accounting) FieldAsInterface(fldPath []string) (val any, err error)

FieldAsInterface func to help EventCost FieldAsInterface

func (Accounting) GetIDWithSet

func (cbs Accounting) GetIDWithSet(cb *BalanceCharge) string

GetIDWithSet attempts to retrieve the UUID of a matching data or create a new one

type Action

type Action struct {
	Id               string
	ActionType       string
	ExtraParameters  string
	Filters          []string
	ExpirationString string // must stay as string because it can have relative values like 1month
	Weight           float64
	Balance          *BalanceFilter
	// contains filtered or unexported fields
}

Action will be filled for each tariff plan with the bonus value for received calls minutes.

func (*Action) Clone

func (a *Action) Clone() (cln *Action)

Clone returns a clone of the action

type ActionConnCfg added in v0.11.0

type ActionConnCfg struct {
	ConnIDs []string
}

type ActionMdl added in v0.11.0

type ActionMdl struct {
	Id              int64
	Tpid            string
	Tag             string  `index:"0" re:".*"`
	Action          string  `index:"1" re:".*"`
	ExtraParameters string  `index:"2" re:".*"`
	Filters         string  `index:"3" re:".*"`
	BalanceTag      string  `index:"4" re:".*"`
	BalanceType     string  `index:"5" re:".*"`
	Categories      string  `index:"6" re:".*"`
	DestinationTags string  `index:"7" re:".*"`
	RatingSubject   string  `index:"8" re:".*"`
	SharedGroups    string  `index:"9" re:".*"`
	ExpiryTime      string  `index:"10" re:".*"`
	TimingTags      string  `index:"11" re:".*"`
	Units           string  `index:"12" re:".*"`
	BalanceWeight   string  `index:"13" re:".*"`
	BalanceBlocker  string  `index:"14" re:".*"`
	BalanceDisabled string  `index:"15" re:".*"`
	Weight          float64 `index:"16" re:".*"`
	CreatedAt       time.Time
}

func (ActionMdl) TableName added in v0.11.0

func (ActionMdl) TableName() string

type ActionMdls added in v0.11.0

type ActionMdls []ActionMdl

func APItoModelAction

func APItoModelAction(as *utils.TPActions) (result ActionMdls)

func APItoModelActions

func APItoModelActions(as []*utils.TPActions) (result ActionMdls)

func (ActionMdls) AsMapTPActions added in v0.11.0

func (tps ActionMdls) AsMapTPActions() (result map[string]*utils.TPActions)

func (ActionMdls) AsTPActions added in v0.11.0

func (tps ActionMdls) AsTPActions() (result []*utils.TPActions)

type ActionPlan

type ActionPlan struct {
	Id            string // informative purpose only
	AccountIDs    utils.StringMap
	ActionTimings []*ActionTiming
}

func (*ActionPlan) CacheClone added in v0.10.5

func (apl *ActionPlan) CacheClone() any

CacheClone returns a clone of ActionPlan used by ltcache CacheCloner

func (*ActionPlan) Clone

func (apl *ActionPlan) Clone() *ActionPlan

Clone clones *ActionPlan

func (*ActionPlan) RemoveAccountID

func (apl *ActionPlan) RemoveAccountID(accID string) (found bool)

type ActionPlanMdl added in v0.11.0

type ActionPlanMdl struct {
	Id         int64
	Tpid       string
	Tag        string  `index:"0" re:".*"`
	ActionsTag string  `index:"1" re:".*"`
	TimingTag  string  `index:"2" re:".*"`
	Weight     float64 `index:"3" re:".*"`
	CreatedAt  time.Time
}

func (ActionPlanMdl) TableName added in v0.11.0

func (ActionPlanMdl) TableName() string

type ActionPlanMdls added in v0.11.0

type ActionPlanMdls []ActionPlanMdl

func APItoModelActionPlan

func APItoModelActionPlan(a *utils.TPActionPlan) (result ActionPlanMdls)

func APItoModelActionPlans

func APItoModelActionPlans(aps []*utils.TPActionPlan) (result ActionPlanMdls)

func (ActionPlanMdls) AsMapTPActionPlans added in v0.11.0

func (tps ActionPlanMdls) AsMapTPActionPlans() (result map[string]*utils.TPActionPlan)

func (ActionPlanMdls) AsTPActionPlans added in v0.11.0

func (tps ActionPlanMdls) AsTPActionPlans() (result []*utils.TPActionPlan)

type ActionTiming

type ActionTiming struct {
	Uuid      string
	Timing    *RateInterval
	ActionsID string
	ExtraData any
	Weight    float64
	// contains filtered or unexported fields
}

func (*ActionTiming) Clone

func (at *ActionTiming) Clone() (cln *ActionTiming)

Clone clones ActionTiming

func (*ActionTiming) Execute

func (at *ActionTiming) Execute(fltrS *FilterS, originService string, thresholdSyConn *thresholdSyConn) (err error)

Execute will execute all actions in an action plan Reports on success/fail via channel if != nil

func (*ActionTiming) GetAccountIDs

func (at *ActionTiming) GetAccountIDs() utils.StringMap

func (*ActionTiming) GetActionPlanID

func (at *ActionTiming) GetActionPlanID() string

func (*ActionTiming) GetNextStartTime

func (at *ActionTiming) GetNextStartTime(refTime time.Time) time.Time

func (*ActionTiming) IsASAP

func (at *ActionTiming) IsASAP() bool

func (*ActionTiming) RemoveAccountID

func (at *ActionTiming) RemoveAccountID(acntID string) (found bool)

func (*ActionTiming) ResetStartTimeCache

func (at *ActionTiming) ResetStartTimeCache()

func (*ActionTiming) SetAccountIDs

func (at *ActionTiming) SetAccountIDs(accIDs utils.StringMap)

func (*ActionTiming) SetActionPlanID

func (at *ActionTiming) SetActionPlanID(id string)

func (*ActionTiming) SetActions

func (at *ActionTiming) SetActions(as Actions)

func (*ActionTiming) Tasks

func (at *ActionTiming) Tasks() (tsks []*Task)

Tasks converts an ActionTiming into multiple Tasks

type ActionTimingPriorityList

type ActionTimingPriorityList []*ActionTiming

Structure to store actions according to execution time and weight

func (ActionTimingPriorityList) Len

func (atpl ActionTimingPriorityList) Len() int

func (ActionTimingPriorityList) Less

func (atpl ActionTimingPriorityList) Less(i, j int) bool

func (ActionTimingPriorityList) Sort

func (atpl ActionTimingPriorityList) Sort()

func (ActionTimingPriorityList) Swap

func (atpl ActionTimingPriorityList) Swap(i, j int)

type ActionTimingWeightOnlyPriorityList

type ActionTimingWeightOnlyPriorityList []*ActionTiming

Structure to store actions according to weight

func (ActionTimingWeightOnlyPriorityList) Len

func (ActionTimingWeightOnlyPriorityList) Less

func (ActionTimingWeightOnlyPriorityList) Sort

func (ActionTimingWeightOnlyPriorityList) Swap

func (atpl ActionTimingWeightOnlyPriorityList) Swap(i, j int)

type ActionTrigger

type ActionTrigger struct {
	ID             string // original csv tag
	UniqueID       string // individual id
	ThresholdType  string //*min_event_counter, *max_event_counter, *min_balance_counter, *max_balance_counter, *min_balance, *max_balance, *balance_expired
	ThresholdValue float64
	Recurrent      bool          // reset excuted flag each run
	MinSleep       time.Duration // Minimum duration between two executions in case of recurrent triggers
	ExpirationDate time.Time
	ActivationDate time.Time
	//BalanceType       string // *monetary/*voice etc
	Balance           *BalanceFilter
	Weight            float64
	ActionsID         string
	MinQueuedItems    int // Trigger actions only if this number is hit (stats only)
	Executed          bool
	LastExecutionTime time.Time
}

func (*ActionTrigger) Clone

func (at *ActionTrigger) Clone() *ActionTrigger

makes a shallow copy of the receiver

func (*ActionTrigger) CreateBalance

func (at *ActionTrigger) CreateBalance() *Balance

func (*ActionTrigger) Equals

func (at *ActionTrigger) Equals(oat *ActionTrigger) bool

func (*ActionTrigger) Execute

func (at *ActionTrigger) Execute(acc *Account, fltrS *FilterS) (err error)

func (*ActionTrigger) FieldAsInterface added in v0.11.0

func (at *ActionTrigger) FieldAsInterface(fldPath []string) (val any, err error)

func (*ActionTrigger) FieldAsString added in v0.11.0

func (at *ActionTrigger) FieldAsString(fldPath []string) (val string, err error)

func (*ActionTrigger) IsActive

func (at *ActionTrigger) IsActive(t time.Time) bool

func (*ActionTrigger) IsExpired

func (at *ActionTrigger) IsExpired(t time.Time) bool

func (*ActionTrigger) Match

func (at *ActionTrigger) Match(a *Action) bool

returns true if the field of the action timing are equeal to the non empty fields of the action

func (*ActionTrigger) String added in v0.11.0

func (at *ActionTrigger) String() string

type ActionTriggerMdl added in v0.11.0

type ActionTriggerMdl struct {
	Id                     int64
	Tpid                   string
	Tag                    string  `index:"0" re:".*"`
	UniqueId               string  `index:"1" re:".*"`
	ThresholdType          string  `index:"2" re:".*"`
	ThresholdValue         float64 `index:"3" re:".*"`
	Recurrent              bool    `index:"4" re:".*"`
	MinSleep               string  `index:"5" re:".*"`
	ExpiryTime             string  `index:"6" re:".*"`
	ActivationTime         string  `index:"7" re:".*"`
	BalanceTag             string  `index:"8" re:".*"`
	BalanceType            string  `index:"9" re:".*"`
	BalanceCategories      string  `index:"10" re:".*"`
	BalanceDestinationTags string  `index:"11" re:".*"`
	BalanceRatingSubject   string  `index:"12" re:".*"`
	BalanceSharedGroups    string  `index:"13" re:".*"`
	BalanceExpiryTime      string  `index:"14" re:".*"`
	BalanceTimingTags      string  `index:"15" re:".*"`
	BalanceWeight          string  `index:"16" re:".*"`
	BalanceBlocker         string  `index:"17" re:".*"`
	BalanceDisabled        string  `index:"18" re:".*"`
	ActionsTag             string  `index:"19" re:".*"`
	Weight                 float64 `index:"20" re:".*"`
	CreatedAt              time.Time
}

func (ActionTriggerMdl) TableName added in v0.11.0

func (ActionTriggerMdl) TableName() string

type ActionTriggerMdls added in v0.11.0

type ActionTriggerMdls []ActionTriggerMdl

func APItoModelActionTrigger

func APItoModelActionTrigger(ats *utils.TPActionTriggers) (result ActionTriggerMdls)

func APItoModelActionTriggers

func APItoModelActionTriggers(ts []*utils.TPActionTriggers) (result ActionTriggerMdls)

func (ActionTriggerMdls) AsMapTPActionTriggers added in v0.11.0

func (tps ActionTriggerMdls) AsMapTPActionTriggers() (result map[string]*utils.TPActionTriggers)

func (ActionTriggerMdls) AsTPActionTriggers added in v0.11.0

func (tps ActionTriggerMdls) AsTPActionTriggers() (result []*utils.TPActionTriggers)

type ActionTriggers

type ActionTriggers []*ActionTrigger

Structure to store actions according to weight

func (ActionTriggers) Clone

func (atpl ActionTriggers) Clone() ActionTriggers

func (ActionTriggers) Len

func (atpl ActionTriggers) Len() int

func (ActionTriggers) Less

func (atpl ActionTriggers) Less(j, i int) bool

we need higher weights earlyer in the list

func (ActionTriggers) Sort

func (atpl ActionTriggers) Sort()

func (ActionTriggers) Swap

func (atpl ActionTriggers) Swap(i, j int)

type Actions

type Actions []*Action

Actions used to store actions according to weight

func (Actions) CacheClone added in v0.10.5

func (a Actions) CacheClone() any

CacheClone returns a clone of Actions used by ltcache CacheCloner

func (Actions) Clone

func (a Actions) Clone() Actions

Clone returns a clone from object

func (Actions) HasAction added in v0.11.0

func (a Actions) HasAction(typ string) bool

HasAction checks if the action list contains an action of the given type.

func (Actions) Len

func (a Actions) Len() int

func (Actions) Less

func (a Actions) Less(j, i int) bool

we need higher weights earlyer in the list

func (Actions) Sort

func (a Actions) Sort()

Sort used to implement sort interface

func (Actions) Swap

func (a Actions) Swap(i, j int)

type AllocatedIP added in v0.11.0

type AllocatedIP struct {
	ProfileID string
	PoolID    string
	Message   string
	Address   netip.Addr
}

AllocatedIP represents one IP allocated on a pool, together with the message.

func (*AllocatedIP) AsNavigableMap added in v0.11.0

func (ip *AllocatedIP) AsNavigableMap() map[string]*utils.DataNode

AsNavigableMap implements engine.NavigableMapper.

func (*AllocatedIP) Digest added in v0.11.0

func (ip *AllocatedIP) Digest() string

Digest returns a string representation of the allocated IP for digest replies.

type ArgRateCDRs

type ArgRateCDRs struct {
	Flags []string
	utils.RPCCDRsFilter
	Tenant  string
	APIOpts map[string]any
}

ArgRateCDRs a cdr with extra flags

type ArgV1ProcessEvent

type ArgV1ProcessEvent struct {
	Flags []string
	utils.CGREvent
	// contains filtered or unexported fields
}

ArgV1ProcessEvent is the CGREvent with proccesing Flags

func (*ArgV1ProcessEvent) Clone added in v0.11.0

func (attr *ArgV1ProcessEvent) Clone() *ArgV1ProcessEvent

Clone creates a clone of the object

func (*ArgV1ProcessEvent) RPCClone added in v0.11.0

func (attr *ArgV1ProcessEvent) RPCClone() (any, error)

RPCClone implements rpcclient.RPCCloner interface

func (*ArgV1ProcessEvent) SetCloneable added in v0.11.0

func (attr *ArgV1ProcessEvent) SetCloneable(rpcCloneable bool)

SetCloneable sets if the args should be clonned on internal connections

type ArgV1ProcessEvents added in v0.11.0

type ArgV1ProcessEvents struct {
	Flags     []string
	CGREvents []*utils.CGREvent
	APIOpts   map[string]any
	// contains filtered or unexported fields
}

ArgV1ProcessEvents defines the structure for holding CGREvents about to be processed by CDRsV1.ProcessEvents.

func (*ArgV1ProcessEvents) Clone added in v0.11.0

func (attr *ArgV1ProcessEvents) Clone() *ArgV1ProcessEvents

Clone creates a clone of the object

func (*ArgV1ProcessEvents) RPCClone added in v0.11.0

func (attr *ArgV1ProcessEvents) RPCClone() (any, error)

RPCClone implements rpcclient.RPCCloner interface

func (*ArgV1ProcessEvents) SetCloneable added in v0.11.0

func (attr *ArgV1ProcessEvents) SetCloneable(rpcCloneable bool)

SetCloneable sets if the args should be clonned on internal connections

type ArgsV2CDRSStoreSMCost

type ArgsV2CDRSStoreSMCost struct {
	Cost           *V2SMCost
	CheckDuplicate bool
	APIOpts        map[string]any
	Tenant         string
}

type AttrActionPlan added in v0.11.0

type AttrActionPlan struct {
	ActionsId string  // Actions id
	TimingID  string  // timingID is used to specify the ID of the timing for a corner case ( e.g. *monthly_estimated )
	Years     string  // semicolon separated list of years this timing is valid on, *any or empty supported
	Months    string  // semicolon separated list of months this timing is valid on, *any or empty supported
	MonthDays string  // semicolon separated list of month's days this timing is valid on, *any or empty supported
	WeekDays  string  // semicolon separated list of week day names this timing is valid on *any or empty supported
	Time      string  // String representing the time this timing starts on, *asap supported
	Weight    float64 // Binding's weight
}

func (*AttrActionPlan) GetRITiming added in v0.11.0

func (attr *AttrActionPlan) GetRITiming(dm *DataManager) (timing *RITiming, err error)

type AttrCDRSStoreSMCost

type AttrCDRSStoreSMCost struct {
	Cost           *SMCost
	CheckDuplicate bool
	APIOpts        map[string]any
	Tenant         string
}

type AttrSProcessEventReply

type AttrSProcessEventReply struct {
	MatchedProfiles []string
	AlteredFields   []string
	*utils.CGREvent
	// contains filtered or unexported fields
}

AttrSProcessEventReply reply used for proccess event

func (*AttrSProcessEventReply) Digest

func (attrReply *AttrSProcessEventReply) Digest() (rplyDigest string)

Digest returns serialized version of alteredFields in AttrSProcessEventReply format fldName1:fldVal1,fldName2:fldVal2

type AttrSetAccount added in v0.11.0

type AttrSetAccount struct {
	Tenant                 string
	Account                string
	ActionPlanIDs          []string
	ActionPlansOverwrite   bool
	ActionTriggerIDs       []string
	ActionTriggerOverwrite bool
	ExtraOptions           map[string]bool
	ReloadScheduler        bool
}

type AttrSetActionPlan added in v0.11.0

type AttrSetActionPlan struct {
	Id              string            // Profile id
	ActionPlan      []*AttrActionPlan // Set of actions this Actions profile will perform
	Overwrite       bool              // If previously defined, will be overwritten
	ReloadScheduler bool              // Enables automatic reload of the scheduler (eg: useful when adding a single action timing)
}

type AttrSetActionPlanAccounts added in v0.11.0

type AttrSetActionPlanAccounts struct {
	Id              string            // Profile id
	ActionPlan      []*AttrActionPlan // Set of actions this Actions profile will perform
	AccountIDs      []string          // Set of accounts which the actions can be performed on
	Overwrite       bool              // If previously defined, will be overwritten
	ReloadScheduler bool              // Enables automatic reload of the scheduler (eg: useful when adding a single action timing)
}

type AttrSetActionTrigger added in v0.11.0

type AttrSetActionTrigger struct {
	GroupID       string
	UniqueID      string
	ActionTrigger map[string]any
}

func (*AttrSetActionTrigger) UpdateActionTrigger added in v0.11.0

func (attr *AttrSetActionTrigger) UpdateActionTrigger(at *ActionTrigger, timezone string) (updated bool, err error)

UpdateActionTrigger updates the ActionTrigger if is matching

type Attribute

type Attribute struct {
	FilterIDs []string
	Path      string
	Type      string
	Value     config.RSRParsers
}

Attribute used by AttributeProfile to describe a single attribute

func (*Attribute) Clone added in v0.11.0

func (a *Attribute) Clone() *Attribute

Clone method for Attribute

type AttributeMdl added in v0.11.0

type AttributeMdl struct {
	PK                 uint `gorm:"primary_key"`
	Tpid               string
	Tenant             string  `index:"0" re:".*"`
	ID                 string  `index:"1" re:".*"`
	Contexts           string  `index:"2" re:".*"`
	FilterIDs          string  `index:"3" re:".*"`
	ActivationInterval string  `index:"4" re:".*"`
	AttributeFilterIDs string  `index:"5" re:".*"`
	Path               string  `index:"6" re:".*"`
	Type               string  `index:"7" re:".*"`
	Value              string  `index:"8" re:".*"`
	Blocker            bool    `index:"9" re:".*"`
	Weight             float64 `index:"10" re:".*"`
	CreatedAt          time.Time
}

func (AttributeMdl) TableName added in v0.11.0

func (AttributeMdl) TableName() string

type AttributeMdls added in v0.11.0

type AttributeMdls []*AttributeMdl

func APItoModelTPAttribute

func APItoModelTPAttribute(th *utils.TPAttributeProfile) (mdls AttributeMdls)

func (AttributeMdls) AsTPAttributes added in v0.11.0

func (tps AttributeMdls) AsTPAttributes() (result []*utils.TPAttributeProfile)

func (AttributeMdls) CSVHeader added in v0.11.0

func (tps AttributeMdls) CSVHeader() (result []string)

CSVHeader return the header for csv fields as a slice of string

type AttributeProfile

type AttributeProfile struct {
	Tenant             string
	ID                 string
	Contexts           []string // bind this AttributeProfile to multiple contexts
	FilterIDs          []string
	ActivationInterval *utils.ActivationInterval // Activation interval
	Attributes         []*Attribute
	Blocker            bool // blocker flag to stop processing on multiple runs
	Weight             float64
}

AttributeProfile the profile definition for the attributes

func APItoAttributeProfile

func APItoAttributeProfile(tpAttr *utils.TPAttributeProfile, timezone string) (attrPrf *AttributeProfile, err error)

func NewAttributeFromInline

func NewAttributeFromInline(tenant, inlnRule string) (attr *AttributeProfile, err error)

NewAttributeFromInline parses an inline rule into a compiled AttributeProfile

func (*AttributeProfile) CacheClone added in v0.11.0

func (ap *AttributeProfile) CacheClone() any

CacheClone returns a clone of AttributeProfile used by ltcache CacheCloner

func (*AttributeProfile) Clone added in v0.11.0

func (ap *AttributeProfile) Clone() *AttributeProfile

Clone method for AttributeProfile struct

func (*AttributeProfile) Compile

func (ap *AttributeProfile) Compile() error

Compile is a wrapper for convenience setting up the AttributeProfile

func (*AttributeProfile) TenantID

func (ap *AttributeProfile) TenantID() string

TenantID returns the tenant wit the ID

func (*AttributeProfile) TenantIDInline added in v0.11.0

func (ap *AttributeProfile) TenantIDInline() string

TenantIDInline returns the id for inline

type AttributeProfileWithAPIOpts added in v0.11.0

type AttributeProfileWithAPIOpts struct {
	*AttributeProfile
	APIOpts map[string]any
}

AttributeProfileWithAPIOpts is used in replicatorV1 for dispatcher

type AttributeProfiles

type AttributeProfiles []*AttributeProfile

AttributeProfiles is a sortable list of Attribute profiles

func (AttributeProfiles) Sort

func (aps AttributeProfiles) Sort()

Sort is part of sort interface, sort based on Weight

type AttributeService

type AttributeService struct {
	// contains filtered or unexported fields
}

AttributeService the service for the API

func NewAttributeService

func NewAttributeService(dm *DataManager, filterS *FilterS,
	cgrcfg *config.CGRConfig) *AttributeService

NewAttributeService returns a new AttributeService

func (*AttributeService) Shutdown

func (alS *AttributeService) Shutdown()

Shutdown is called to shutdown the service

func (*AttributeService) V1GetAttributeForEvent

func (alS *AttributeService) V1GetAttributeForEvent(ctx *context.Context, args *utils.CGREvent,
	attrPrfl *AttributeProfile) (err error)

V1GetAttributeForEvent returns the AttributeProfile that matches the event

func (*AttributeService) V1ProcessEvent

func (alS *AttributeService) V1ProcessEvent(ctx *context.Context, args *utils.CGREvent,
	reply *AttrSProcessEventReply) (err error)

V1ProcessEvent proccess the event and returns the result

type BSONMarshaler

type BSONMarshaler struct{}

func (*BSONMarshaler) Marshal

func (jm *BSONMarshaler) Marshal(v any) ([]byte, error)

func (*BSONMarshaler) Unmarshal

func (jm *BSONMarshaler) Unmarshal(data []byte, v any) error

type Balance

type Balance struct {
	Uuid           string // system wide unique
	ID             string // account wide unique
	Value          float64
	ExpirationDate time.Time
	Weight         float64
	DestinationIDs utils.StringMap
	RatingSubject  string
	Categories     utils.StringMap
	SharedGroups   utils.StringMap
	Timings        []*RITiming
	TimingIDs      utils.StringMap
	Disabled       bool
	Factors        ValueFactors
	Blocker        bool
	// contains filtered or unexported fields
}

Can hold different units as seconds or monetary

func (*Balance) AddValue

func (b *Balance) AddValue(amount float64)

func (*Balance) AsBalanceSummary

func (b *Balance) AsBalanceSummary(typ string) *BalanceSummary

AsBalanceSummary converts the balance towards compressed information to be displayed

func (*Balance) Clone

func (b *Balance) Clone() *Balance

func (*Balance) Equal

func (b *Balance) Equal(o *Balance) bool

func (*Balance) FieldAsInterface added in v0.11.0

func (b *Balance) FieldAsInterface(fldPath []string) (val any, err error)

func (*Balance) FieldAsString added in v0.11.0

func (b *Balance) FieldAsString(fldPath []string) (val string, err error)

func (*Balance) GetCost

func (b *Balance) GetCost(cd *CallDescriptor, getStandardIfEmpty bool) (*CallCost, error)

Gets the cost using balance RatingSubject if present otherwize retuns a callcost obtained using standard rating

func (*Balance) GetMinutesForCredit

func (b *Balance) GetMinutesForCredit(origCD *CallDescriptor, initialCredit float64) (duration time.Duration, credit float64)

Returns the available number of seconds for a specified credit

func (*Balance) GetValue

func (b *Balance) GetValue() float64

func (*Balance) HardMatchFilter

func (b *Balance) HardMatchFilter(o *BalanceFilter, skipIds bool) bool

func (*Balance) HasDestination

func (b *Balance) HasDestination() bool

func (*Balance) IsActive

func (b *Balance) IsActive() bool

func (*Balance) IsActiveAt

func (b *Balance) IsActiveAt(t time.Time) bool

func (*Balance) IsDefault

func (b *Balance) IsDefault() bool

the default balance has standard Id

func (*Balance) IsExpiredAt

func (b *Balance) IsExpiredAt(t time.Time) bool

IsExpiredAt check if ExpirationDate is before time t

func (*Balance) MatchActionTrigger

func (b *Balance) MatchActionTrigger(at *ActionTrigger) bool

func (*Balance) MatchCategory

func (b *Balance) MatchCategory(category string) bool

func (*Balance) MatchDestination

func (b *Balance) MatchDestination(destinationID string) bool

func (*Balance) MatchFilter

func (b *Balance) MatchFilter(o *BalanceFilter, bType string, skipIds, skipExpiry bool) bool

func (*Balance) SetDirty

func (b *Balance) SetDirty()

func (*Balance) SetValue

func (b *Balance) SetValue(amount float64)

func (*Balance) String added in v0.11.0

func (b *Balance) String() string

func (*Balance) SubtractValue added in v0.11.0

func (b *Balance) SubtractValue(amount float64)

type BalanceCharge

type BalanceCharge struct {
	AccountID     string  // reference for shared balances
	BalanceUUID   string  // balance charged
	RatingID      string  // special price applied on this balance
	Units         float64 // number of units charged
	BalanceFactor float64 `json:",omitempty"` // calculation multiplier for units
	ExtraChargeID string  // used in cases when paying *voice with *monetary
}

BalanceCharge represents one unit charged to a balance

func (*BalanceCharge) Clone

func (bc *BalanceCharge) Clone() *BalanceCharge

Clone creates a copy of BalanceCharge

func (*BalanceCharge) Equals

func (bc *BalanceCharge) Equals(oBC *BalanceCharge) bool

Equals checks if two BalanceCharge instances are equivalent, comparing all fields directly, while treating empty ExtraChargeID as utils.MetaNone.

func (*BalanceCharge) FieldAsInterface

func (bc *BalanceCharge) FieldAsInterface(fldPath []string) (val any, err error)

FieldAsInterface func to help EventCost FieldAsInterface

type BalanceFilter

type BalanceFilter struct {
	Uuid           *string
	ID             *string
	Type           *string
	Value          *utils.ValueFormula
	ExpirationDate *time.Time
	Weight         *float64
	DestinationIDs *utils.StringMap
	RatingSubject  *string
	Categories     *utils.StringMap
	SharedGroups   *utils.StringMap
	TimingIDs      *utils.StringMap
	Timings        []*RITiming
	Disabled       *bool
	Factors        *ValueFactors
	Blocker        *bool
}

func NewBalanceFilter

func NewBalanceFilter(filter map[string]any, defaultTimezone string) (*BalanceFilter, error)

NewBalanceFilter creates a new BalanceFilter based on given filter

func (*BalanceFilter) Clone

func (bf *BalanceFilter) Clone() *BalanceFilter

func (*BalanceFilter) CreateBalance

func (bp *BalanceFilter) CreateBalance() *Balance

func (*BalanceFilter) EmptyExpirationDate

func (bp *BalanceFilter) EmptyExpirationDate() bool

func (*BalanceFilter) Equal

func (bp *BalanceFilter) Equal(o *BalanceFilter) bool

func (*BalanceFilter) FieldAsInterface added in v0.11.0

func (bp *BalanceFilter) FieldAsInterface(fldPath []string) (val any, err error)

func (*BalanceFilter) FieldAsString added in v0.11.0

func (bp *BalanceFilter) FieldAsString(fldPath []string) (val string, err error)

func (*BalanceFilter) GetBlocker

func (bp *BalanceFilter) GetBlocker() bool

func (*BalanceFilter) GetCategories

func (bp *BalanceFilter) GetCategories() utils.StringMap

func (*BalanceFilter) GetDestinationIDs

func (bp *BalanceFilter) GetDestinationIDs() utils.StringMap

func (*BalanceFilter) GetDisabled

func (bp *BalanceFilter) GetDisabled() bool

func (*BalanceFilter) GetExpirationDate

func (bp *BalanceFilter) GetExpirationDate() time.Time

func (*BalanceFilter) GetFactors added in v0.11.0

func (bp *BalanceFilter) GetFactors() ValueFactors

func (*BalanceFilter) GetID

func (bp *BalanceFilter) GetID() string

func (*BalanceFilter) GetRatingSubject

func (bp *BalanceFilter) GetRatingSubject() string

func (*BalanceFilter) GetSharedGroups

func (bp *BalanceFilter) GetSharedGroups() utils.StringMap

func (*BalanceFilter) GetTimingIDs

func (bp *BalanceFilter) GetTimingIDs() utils.StringMap

func (*BalanceFilter) GetType

func (bp *BalanceFilter) GetType() string

func (*BalanceFilter) GetUuid

func (bp *BalanceFilter) GetUuid() string

func (*BalanceFilter) GetValue

func (bp *BalanceFilter) GetValue() float64

func (*BalanceFilter) GetWeight

func (bp *BalanceFilter) GetWeight() float64

func (*BalanceFilter) LoadFromBalance

func (bf *BalanceFilter) LoadFromBalance(b *Balance) *BalanceFilter

func (*BalanceFilter) ModifyBalance

func (bf *BalanceFilter) ModifyBalance(b *Balance)

func (*BalanceFilter) SetValue

func (bp *BalanceFilter) SetValue(v float64)

func (*BalanceFilter) String added in v0.11.0

func (bp *BalanceFilter) String() string

type BalanceSummaries

type BalanceSummaries []*BalanceSummary

BalanceSummaries is a list of BalanceSummaries

func (BalanceSummaries) BalanceSummaryWithUUD

func (bs BalanceSummaries) BalanceSummaryWithUUD(bsUUID string) (b *BalanceSummary)

BalanceSummaryWithUUD returns a BalanceSummary based on an UUID

type BalanceSummary

type BalanceSummary struct {
	UUID     string  // Balance UUID
	ID       string  // Balance ID  if not defined
	Type     string  // *voice, *data, etc
	Initial  float64 // initial value before the debit operation
	Value    float64
	Weight   float64 `json:",omitempty"`
	Disabled bool
	Factors  ValueFactors `json:",omitempty"`
}

BalanceSummary represents compressed information about a balance

func (*BalanceSummary) FieldAsInterface

func (bl *BalanceSummary) FieldAsInterface(fldPath []string) (val any, err error)

FieldAsInterface func to help EventCost FieldAsInterface

type Balances

type Balances []*Balance

Structure to store minute buckets according to weight, precision or price.

func (Balances) Clone

func (bc Balances) Clone() Balances

func (Balances) Equal

func (bc Balances) Equal(o Balances) bool

func (Balances) FieldAsInterface added in v0.11.0

func (bc Balances) FieldAsInterface(fldPath []string) (val any, err error)

func (Balances) FieldAsString added in v0.11.0

func (bc Balances) FieldAsString(fldPath []string) (val string, err error)

func (Balances) GetBalance

func (bc Balances) GetBalance(uuid string) *Balance

func (Balances) GetTotalValue

func (bc Balances) GetTotalValue() (total float64)

func (Balances) HasBalance

func (bc Balances) HasBalance(balance *Balance) bool

func (Balances) Len

func (bc Balances) Len() int

func (Balances) Less

func (bc Balances) Less(j, i int) bool

we need the better ones at the beginning

func (Balances) SaveDirtyBalances

func (bc Balances) SaveDirtyBalances(acc *Account, initBal map[string]float64)

func (Balances) Sort

func (bc Balances) Sort()

func (Balances) String added in v0.11.0

func (bc Balances) String() string

func (Balances) Swap

func (bc Balances) Swap(i, j int)

type BincMarshaler

type BincMarshaler struct {
	// contains filtered or unexported fields
}

func NewBincMarshaler

func NewBincMarshaler() *BincMarshaler

func (*BincMarshaler) Marshal

func (bm *BincMarshaler) Marshal(v any) (b []byte, err error)

func (*BincMarshaler) Unmarshal

func (bm *BincMarshaler) Unmarshal(data []byte, v any) error

type CDR

type CDR struct {
	CGRID       string
	RunID       string
	OrderID     int64             // Stor order id used as export order id
	OriginHost  string            // represents the IP address of the host generating the CDR (automatically populated by the server)
	Source      string            // formally identifies the source of the CDR (free form field)
	OriginID    string            // represents the unique accounting id given by the telecom switch generating the CDR
	ToR         string            // type of record, meta-field, should map to one of the TORs hardcoded inside the server <*voice|*data|*sms|*generic>
	RequestType string            // matching the supported request types by the **CGRateS**, accepted values are hardcoded in the server <prepaid|postpaid|pseudoprepaid|rated>.
	Tenant      string            // tenant whom this record belongs
	Category    string            // free-form filter for this record, matching the category defined in rating profiles.
	Account     string            // account id (accounting subsystem) the record should be attached to
	Subject     string            // rating subject (rating subsystem) this record should be attached to
	Destination string            // destination to be charged
	SetupTime   time.Time         // set-up time of the event. Supported formats: datetime RFC3339 compatible, SQL datetime (eg: MySQL), unix timestamp.
	AnswerTime  time.Time         // answer time of the event. Supported formats: datetime RFC3339 compatible, SQL datetime (eg: MySQL), unix timestamp.
	Usage       time.Duration     // event usage information (eg: in case of tor=*voice this will represent the total duration of a call)
	ExtraFields map[string]string // Extra fields to be stored in CDR
	ExtraInfo   string            // Container for extra information related to this CDR, eg: populated with error reason in case of error on calculation
	Partial     bool              // Used for partial record processing by ERs
	PreRated    bool              // Mark the CDR as rated so we do not process it during rating
	CostSource  string            // The source of this cost
	Cost        float64           //
	CostDetails *EventCost        // Attach the cost details to CDR when possible
}

func NewCDRFromCompressedCDR added in v0.11.0

func NewCDRFromCompressedCDR(cdrCompressed *CompressedCostCDR, ms Marshaler) (*CDR, error)

func NewCDRFromExternalCDR

func NewCDRFromExternalCDR(extCdr *ExternalCDR, timezone string) (*CDR, error)

func NewCDRFromSQL

func NewCDRFromSQL(cdrSQL *CDRsql, ms Marshaler) (cdr *CDR, err error)

NewCDRFromSQL converts the CDRsql into CDR

func (*CDR) AddDefaults

func (cdr *CDR) AddDefaults(cfg *config.CGRConfig)

AddDefaults will add missing information based on other fields

func (*CDR) AsCDRsql

func (cdr *CDR) AsCDRsql(ms Marshaler) (cdrSQL *CDRsql, err error)

AsCDRsql converts the CDR into the format used for SQL storage

func (*CDR) AsCGREvent

func (cdr *CDR) AsCGREvent() *utils.CGREvent

func (*CDR) AsCompressedCostCDR added in v0.11.0

func (cdr *CDR) AsCompressedCostCDR(ms Marshaler) (*CompressedCostCDR, error)

func (*CDR) AsExternalCDR

func (cdr *CDR) AsExternalCDR() *ExternalCDR

func (*CDR) AsMapStorage added in v0.10.3

func (cdr *CDR) AsMapStorage() (mp utils.MapStorage)

func (*CDR) AsMapStringIface

func (cdr *CDR) AsMapStringIface() (mp map[string]any)

func (*CDR) CacheClone added in v0.11.0

func (cdr *CDR) CacheClone() any

CacheClone returns a clone of CDR used by ltcache CacheCloner

func (*CDR) Clone

func (cdr *CDR) Clone() *CDR

func (*CDR) ComputeCGRID

func (cdr *CDR) ComputeCGRID()

func (*CDR) CostDetailsJson

func (cdr *CDR) CostDetailsJson() string

func (*CDR) FieldAsString

func (cdr *CDR) FieldAsString(rsrPrs *config.RSRParser) (parsed string, err error)

FieldAsString is used to retrieve fields as string, primary fields are const labeled

func (*CDR) FieldsAsString

func (cdr *CDR) FieldsAsString(rsrFlds config.RSRParsers) string

FieldsAsString concatenates values of multiple fields defined in template, used eg in CDR templates

func (*CDR) FormatCost

func (cdr *CDR) FormatCost(shiftDecimals, roundDecimals int) string

FormatCost formats the cost as string on export

func (*CDR) String

func (cdr *CDR) String() string

type CDRServer

type CDRServer struct {
	// contains filtered or unexported fields
}

CDRServer stores and rates CDRs

func NewCDRServer

func NewCDRServer(cgrCfg *config.CGRConfig, storDBChan chan StorDB, dm *DataManager, filterS *FilterS,
	connMgr *ConnManager) *CDRServer

NewCDRServer is a constructor for CDRServer

func (*CDRServer) ListenAndServe

func (cdrS *CDRServer) ListenAndServe(stopChan chan struct{})

ListenAndServe listen for storbd reload

func (*CDRServer) RegisterHandlersToServer

func (cdrS *CDRServer) RegisterHandlersToServer(server utils.Server)

RegisterHandlersToServer is called by cgr-engine to register HTTP URL handlers

func (*CDRServer) V1GetCDRs

func (cdrS *CDRServer) V1GetCDRs(ctx *context.Context, args utils.RPCCDRsFilterWithAPIOpts, cdrs *[]*CDR) error

V1GetCDRs returns CDRs from DB

func (*CDRServer) V1GetCDRsCount added in v0.11.0

func (cdrS *CDRServer) V1GetCDRsCount(ctx *context.Context, args *utils.RPCCDRsFilterWithAPIOpts, cnt *int64) error

V1GetCDRsCount counts CDRs from DB

func (*CDRServer) V1ProcessCDR

func (cdrS *CDRServer) V1ProcessCDR(ctx *context.Context, cdr *CDRWithAPIOpts, reply *string) (err error)

V1ProcessCDR processes a CDR

func (*CDRServer) V1ProcessEvent

func (cdrS *CDRServer) V1ProcessEvent(ctx *context.Context, arg *ArgV1ProcessEvent, reply *string) (err error)

V1ProcessEvent will process the CGREvent

func (*CDRServer) V1ProcessEvents added in v0.11.0

func (cdrS *CDRServer) V1ProcessEvents(ctx *context.Context, arg *ArgV1ProcessEvents, reply *string) (err error)

V1ProcessEvents is similar to V1ProcessEvent but it can accept multiple CGREvents inside the parameter.

func (*CDRServer) V1ProcessExternalCDR

func (cdrS *CDRServer) V1ProcessExternalCDR(ctx *context.Context, eCDR *ExternalCDRWithAPIOpts, reply *string) error

V1ProcessExternalCDR is used to process external CDRs

func (*CDRServer) V1RateCDRs

func (cdrS *CDRServer) V1RateCDRs(ctx *context.Context, arg *ArgRateCDRs, reply *string) (err error)

V1RateCDRs is used for re-/rate CDRs which are already stored within StorDB FixMe: add RPC caching

func (*CDRServer) V1ReprocessCDRs added in v0.11.0

func (cdrS *CDRServer) V1ReprocessCDRs(ctx *context.Context, arg *ArgRateCDRs, reply *string) (err error)

V1ReprocessCDRs is used to reprocess CDRs which are already stored within StorDB

func (*CDRServer) V1StoreSessionCost

func (cdrS *CDRServer) V1StoreSessionCost(ctx *context.Context, attr *AttrCDRSStoreSMCost, reply *string) (err error)

V1StoreSessionCost handles storing of the cost into session_costs table

func (*CDRServer) V2ProcessEvent added in v0.11.0

func (cdrS *CDRServer) V2ProcessEvent(ctx *context.Context, arg *ArgV1ProcessEvent, evs *[]*utils.EventWithFlags) (err error)

V2ProcessEvent has the same logic with V1ProcessEvent except it adds the proccessed events to the reply

func (*CDRServer) V2StoreSessionCost

func (cdrS *CDRServer) V2StoreSessionCost(ctx *context.Context, args *ArgsV2CDRSStoreSMCost, reply *string) (err error)

V2StoreSessionCost will store the SessionCost into session_costs table

type CDRWithAPIOpts added in v0.11.0

type CDRWithAPIOpts struct {
	*CDR
	APIOpts map[string]any
}

type CDRsql

type CDRsql struct {
	ID          int64
	Cgrid       string
	RunID       string
	OriginHost  string
	Source      string
	OriginID    string
	TOR         string
	RequestType string
	Tenant      string
	Category    string
	Account     string
	Subject     string
	Destination string
	SetupTime   time.Time
	AnswerTime  *time.Time
	Usage       int64
	ExtraFields string
	CostSource  string
	Cost        float64
	CostDetails string
	ExtraInfo   string
	CreatedAt   time.Time
	UpdatedAt   time.Time
	DeletedAt   *time.Time
}

func (CDRsql) AsMapStringInterface

func (t CDRsql) AsMapStringInterface() (out map[string]any)

func (CDRsql) TableName

func (t CDRsql) TableName() string

type CGREventWithEeIDs added in v0.11.0

type CGREventWithEeIDs struct {
	EeIDs []string
	*utils.CGREvent
	// contains filtered or unexported fields
}

CGREventWithEeIDs is CGREvent with EventExporterIDs. This struct is used as an API argument. It has been moved into the engine package to avoid import cycling issues that were encountered when trying to properly handle unmarshalling for our EventCost type.

func (*CGREventWithEeIDs) Clone added in v0.11.0

func (attr *CGREventWithEeIDs) Clone() *CGREventWithEeIDs

func (*CGREventWithEeIDs) RPCClone added in v0.11.0

func (attr *CGREventWithEeIDs) RPCClone() (any, error)

RPCClone implements rpcclient.RPCCloner interface

func (*CGREventWithEeIDs) SetCloneable added in v0.11.0

func (attr *CGREventWithEeIDs) SetCloneable(clnb bool)

SetCloneable sets if the args should be cloned on internal connections

func (*CGREventWithEeIDs) UnmarshalJSON added in v0.11.0

func (cgr *CGREventWithEeIDs) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes the JSON data into a CGREventWithEeIDs, while ensuring that the CostDetails key of the embedded CGREvent is of type *engine.EventCost.

type CSVStorage

type CSVStorage struct {
	// contains filtered or unexported fields
}

CSVStorage the basic csv storage

func NewCSVStorage

func NewCSVStorage(sep rune,
	destinationsFn, timingsFn, ratesFn, destinationratesFn,
	destinationratetimingsFn, ratingprofilesFn, sharedgroupsFn,
	actionsFn, actiontimingsFn, actiontriggersFn, accountactionsFn,
	resProfilesFn, ipProfilesFn, statsFn, trendsFn, rankingsFn, thresholdsFn, filterFn, routeProfilesFn,
	attributeProfilesFn, chargerProfilesFn, dispatcherProfilesFn, dispatcherHostsFn []string) *CSVStorage

NewCSVStorage creates a CSV storage that takes the data from the paths specified

func NewFileCSVStorage

func NewFileCSVStorage(sep rune, dataPath string) (*CSVStorage, error)

NewFileCSVStorage returns a csv storage that uses all files from the folder

func NewGoogleCSVStorage

func NewGoogleCSVStorage(sep rune, spreadsheetID string) (*CSVStorage, error)

NewGoogleCSVStorage creates a csv storege from google sheets

func NewStringCSVStorage

func NewStringCSVStorage(sep rune,
	destinationsFn, timingsFn, ratesFn, destinationratesFn,
	destinationratetimingsFn, ratingprofilesFn, sharedgroupsFn,
	actionsFn, actiontimingsFn, actiontriggersFn, accountactionsFn,
	resProfilesFn, ipProfilesFn, statsFn, trendsFn, rankingsFn, thresholdsFn, filterFn, routeProfilesFn,
	attributeProfilesFn, chargerProfilesFn, dispatcherProfilesFn, dispatcherHostsFn string) *CSVStorage

NewStringCSVStorage creates a csv storage from strings

func NewURLCSVStorage added in v0.11.0

func NewURLCSVStorage(sep rune, dataPath string) *CSVStorage

NewURLCSVStorage returns a CSVStorage that can parse URLs

func (*CSVStorage) GetTPAccountActions

func (csvs *CSVStorage) GetTPAccountActions(filter *utils.TPAccountActions) ([]*utils.TPAccountActions, error)

func (*CSVStorage) GetTPActionPlans

func (csvs *CSVStorage) GetTPActionPlans(tpid, id string) ([]*utils.TPActionPlan, error)

func (*CSVStorage) GetTPActionTriggers

func (csvs *CSVStorage) GetTPActionTriggers(tpid, id string) ([]*utils.TPActionTriggers, error)

func (*CSVStorage) GetTPActions

func (csvs *CSVStorage) GetTPActions(tpid, id string) ([]*utils.TPActions, error)

func (*CSVStorage) GetTPAttributes

func (csvs *CSVStorage) GetTPAttributes(tpid, tenant, id string) ([]*utils.TPAttributeProfile, error)

func (*CSVStorage) GetTPChargers

func (csvs *CSVStorage) GetTPChargers(tpid, tenant, id string) ([]*utils.TPChargerProfile, error)

func (*CSVStorage) GetTPDestinationRates

func (csvs *CSVStorage) GetTPDestinationRates(tpid, id string, p *utils.Paginator) ([]*utils.TPDestinationRate, error)

func (*CSVStorage) GetTPDestinations

func (csvs *CSVStorage) GetTPDestinations(tpid, id string) ([]*utils.TPDestination, error)

func (*CSVStorage) GetTPDispatcherHosts

func (csvs *CSVStorage) GetTPDispatcherHosts(tpid, tenant, id string) ([]*utils.TPDispatcherHost, error)

func (*CSVStorage) GetTPDispatcherProfiles

func (csvs *CSVStorage) GetTPDispatcherProfiles(tpid, tenant, id string) ([]*utils.TPDispatcherProfile, error)

func (*CSVStorage) GetTPFilters

func (csvs *CSVStorage) GetTPFilters(tpid, tenant, id string) ([]*utils.TPFilterProfile, error)

func (*CSVStorage) GetTPIPs added in v0.11.0

func (csvs *CSVStorage) GetTPIPs(tpid, tenant, id string) ([]*utils.TPIPProfile, error)

func (*CSVStorage) GetTPRankings added in v0.11.0

func (csvs *CSVStorage) GetTPRankings(tpid, tenant, id string) ([]*utils.TPRankingProfile, error)

func (*CSVStorage) GetTPRates

func (csvs *CSVStorage) GetTPRates(tpid, id string) ([]*utils.TPRateRALs, error)

func (*CSVStorage) GetTPRatingPlans

func (csvs *CSVStorage) GetTPRatingPlans(tpid, id string, p *utils.Paginator) ([]*utils.TPRatingPlan, error)

func (*CSVStorage) GetTPRatingProfiles

func (csvs *CSVStorage) GetTPRatingProfiles(filter *utils.TPRatingProfile) ([]*utils.TPRatingProfile, error)

func (*CSVStorage) GetTPResources

func (csvs *CSVStorage) GetTPResources(tpid, tenant, id string) ([]*utils.TPResourceProfile, error)

func (*CSVStorage) GetTPRoutes added in v0.11.0

func (csvs *CSVStorage) GetTPRoutes(tpid, tenant, id string) ([]*utils.TPRouteProfile, error)

func (*CSVStorage) GetTPSharedGroups

func (csvs *CSVStorage) GetTPSharedGroups(tpid, id string) ([]*utils.TPSharedGroups, error)

func (*CSVStorage) GetTPStats

func (csvs *CSVStorage) GetTPStats(tpid, tenant, id string) ([]*utils.TPStatProfile, error)

func (*CSVStorage) GetTPThresholds

func (csvs *CSVStorage) GetTPThresholds(tpid, tenant, id string) ([]*utils.TPThresholdProfile, error)

func (*CSVStorage) GetTPTimings

func (csvs *CSVStorage) GetTPTimings(tpid, id string) ([]*utils.ApierTPTiming, error)

func (*CSVStorage) GetTPTrends added in v0.11.0

func (csvs *CSVStorage) GetTPTrends(tpid, tenant, id string) ([]*utils.TPTrendsProfile, error)

func (*CSVStorage) GetTpIds

func (csvs *CSVStorage) GetTpIds(colName string) ([]string, error)

func (*CSVStorage) GetTpTableIds

func (csvs *CSVStorage) GetTpTableIds(tpid, table string,
	distinct utils.TPDistinctIds, filters map[string]string, p *utils.PaginatorWithSearch) ([]string, error)

type CacheS

type CacheS struct {
	// contains filtered or unexported fields
}

CacheS deals with cache preload and other cache related tasks/APIs

var Cache *CacheS

func NewCacheS

func NewCacheS(cfg *config.CGRConfig, dm *DataManager, cpS *CapsStats) (c *CacheS)

NewCacheS initializes the Cache service and executes the precaching

func (*CacheS) BeginTransaction added in v0.11.0

func (chS *CacheS) BeginTransaction() string

BeginTransaction is an exported method from TransCache

func (*CacheS) Clear added in v0.11.0

func (chS *CacheS) Clear(chIDs []string)

Clear is an exported method from TransCache

func (*CacheS) CommitTransaction added in v0.11.0

func (chS *CacheS) CommitTransaction(transID string)

CommitTransaction is an exported method from TransCache

func (*CacheS) Get added in v0.11.0

func (chS *CacheS) Get(chID, itmID string) (any, bool)

Get is an exported method from TransCache

func (*CacheS) GetItemIDs added in v0.11.0

func (chS *CacheS) GetItemIDs(chID, prfx string) (itmIDs []string)

GetItemIDs is an exported method from TransCache

func (*CacheS) GetPrecacheChannel

func (chS *CacheS) GetPrecacheChannel(chID string) chan struct{}

GetPrecacheChannel returns the channel used to signal precaching

func (*CacheS) GetWithRemote added in v0.11.0

func (chS *CacheS) GetWithRemote(args *utils.ArgsGetCacheItemWithAPIOpts) (itm any, err error)

GetWithRemote queries locally the cache, followed by remotes

func (*CacheS) HasItem added in v0.11.0

func (chS *CacheS) HasItem(chID, itmID string) (has bool)

HasItem is an exported method from TransCache

func (*CacheS) Precache

func (chS *CacheS) Precache() (err error)

Precache loads data from DataDB into cache at engine start

func (*CacheS) Remove added in v0.11.0

func (chS *CacheS) Remove(chID, itmID string, commit bool, transID string) (err error)

Remove is an exported method from TransCache

func (*CacheS) RemoveGroup added in v0.11.0

func (chS *CacheS) RemoveGroup(cacheID, groupID string)

func (*CacheS) RemoveWithoutReplicate added in v0.11.0

func (chS *CacheS) RemoveWithoutReplicate(chID, itmID string, commit bool, transID string)

RemoveWithoutReplicate is an exported method from TransCache

func (*CacheS) ReplicateRemove added in v0.11.0

func (chS *CacheS) ReplicateRemove(chID, itmID string) (err error)

ReplicateRemove replicate an item to ReplicationConns

func (*CacheS) ReplicateSet added in v0.11.0

func (chS *CacheS) ReplicateSet(chID, itmID string, value any) (err error)

ReplicateSet replicates an item to ReplicationConns

func (*CacheS) RollbackTransaction added in v0.11.0

func (chS *CacheS) RollbackTransaction(transID string)

RollbackTransaction is an exported method from TransCache

func (*CacheS) Set added in v0.11.0

func (chS *CacheS) Set(chID, itmID string, value any,
	groupIDs []string, commit bool, transID string) (err error)

Set is an exported method from TransCache handled Replicate functionality

func (*CacheS) SetWithReplicate added in v0.11.0

func (chS *CacheS) SetWithReplicate(args *utils.ArgCacheReplicateSet) (err error)

SetWithReplicate combines local set with replicate, receiving the arguments needed by dispatcher

func (*CacheS) SetWithoutReplicate added in v0.11.0

func (chS *CacheS) SetWithoutReplicate(chID, itmID string, value any,
	groupIDs []string, commit bool, transID string)

SetWithoutReplicate is an exported method from TransCache handled Replicate functionality

func (*CacheS) V1Clear

func (chS *CacheS) V1Clear(ctx *context.Context, args *utils.AttrCacheIDsWithAPIOpts,
	reply *string) (err error)

func (*CacheS) V1GetCacheStats

func (chS *CacheS) V1GetCacheStats(ctx *context.Context, args *utils.AttrCacheIDsWithAPIOpts,
	rply *map[string]*ltcache.CacheStats) (err error)

func (*CacheS) V1GetGroupItemIDs

func (chS *CacheS) V1GetGroupItemIDs(ctx *context.Context, args *utils.ArgsGetGroupWithAPIOpts,
	rply *[]string) (err error)

func (*CacheS) V1GetItem added in v0.11.0

func (chS *CacheS) V1GetItem(ctx *context.Context, args *utils.ArgsGetCacheItemWithAPIOpts,
	reply *any) (err error)

V1GetItem returns a single item from the cache

func (*CacheS) V1GetItemExpiryTime

func (chS *CacheS) V1GetItemExpiryTime(ctx *context.Context, args *utils.ArgsGetCacheItemWithAPIOpts,
	reply *time.Time) (err error)

func (*CacheS) V1GetItemIDs

func (chS *CacheS) V1GetItemIDs(ctx *context.Context, args *utils.ArgsGetCacheItemIDsWithAPIOpts,
	reply *[]string) (err error)

func (*CacheS) V1GetItemWithRemote added in v0.11.0

func (chS *CacheS) V1GetItemWithRemote(ctx *context.Context, args *utils.ArgsGetCacheItemWithAPIOpts,
	reply *any) (err error)

V1GetItemWithRemote queries the item from remote if not found locally

func (*CacheS) V1GetStats added in v0.11.0

func (chS *CacheS) V1GetStats(ctx *context.Context, args *utils.AttrCacheIDsWithAPIOpts,
	rply *CacheStatsWithMetadata) error

func (*CacheS) V1HasGroup

func (chS *CacheS) V1HasGroup(ctx *context.Context, args *utils.ArgsGetGroupWithAPIOpts,
	rply *bool) (err error)

func (*CacheS) V1HasItem

func (chS *CacheS) V1HasItem(ctx *context.Context, args *utils.ArgsGetCacheItemWithAPIOpts,
	reply *bool) (err error)

func (*CacheS) V1LoadCache

func (chS *CacheS) V1LoadCache(ctx *context.Context, attrs *utils.AttrReloadCacheWithAPIOpts, reply *string) (err error)

func (*CacheS) V1PrecacheStatus

func (chS *CacheS) V1PrecacheStatus(ctx *context.Context, args *utils.AttrCacheIDsWithAPIOpts, rply *map[string]string) (err error)

func (*CacheS) V1ReloadCache

func (chS *CacheS) V1ReloadCache(ctx *context.Context, attrs *utils.AttrReloadCacheWithAPIOpts, reply *string) (err error)

func (*CacheS) V1RemoveGroup

func (chS *CacheS) V1RemoveGroup(ctx *context.Context, args *utils.ArgsGetGroupWithAPIOpts,
	rply *string) (err error)

func (*CacheS) V1RemoveItem

func (chS *CacheS) V1RemoveItem(ctx *context.Context, args *utils.ArgsGetCacheItemWithAPIOpts,
	reply *string) (err error)

func (*CacheS) V1RemoveItems added in v0.11.0

func (chS *CacheS) V1RemoveItems(ctx *context.Context, args *utils.AttrReloadCacheWithAPIOpts,
	reply *string) (err error)

func (*CacheS) V1ReplicateRemove added in v0.11.0

func (chS *CacheS) V1ReplicateRemove(ctx *context.Context, args *utils.ArgCacheReplicateRemove, reply *string) (err error)

V1ReplicateRemove replicate an item

func (*CacheS) V1ReplicateSet added in v0.11.0

func (chS *CacheS) V1ReplicateSet(ctx *context.Context, args *utils.ArgCacheReplicateSet, reply *string) (err error)

V1ReplicateSet receives an item via replication to store in the cache

type CacheStatsWithMetadata added in v0.11.0

type CacheStatsWithMetadata struct {
	CacheStatistics map[string]*ltcache.CacheStats
	Metadata        map[string]any
}

type CallCost

type CallCost struct {
	Category       string
	Tenant         string
	Subject        string
	Account        string
	Destination    string
	ToR            string
	Cost           float64
	Timespans      TimeSpans
	RatedUsage     float64
	AccountSummary *AccountSummary
	// contains filtered or unexported fields
}

The output structure that will be returned with the call cost information.

func (*CallCost) CreateCallDescriptor

func (cc *CallCost) CreateCallDescriptor() *CallDescriptor

Creates a CallDescriptor structure copying related data from CallCost

func (*CallCost) GetConnectFee

func (cc *CallCost) GetConnectFee() float64

func (*CallCost) GetDuration

func (cc *CallCost) GetDuration() (td time.Duration)

func (*CallCost) GetEndTime

func (cc *CallCost) GetEndTime() time.Time

func (*CallCost) GetLongestRounding

func (cc *CallCost) GetLongestRounding() (roundingDecimals int, roundingMethod string)

func (*CallCost) GetRoundIncrements

func (cc *CallCost) GetRoundIncrements() (roundIncrements Increments)

func (*CallCost) GetStartTime

func (cc *CallCost) GetStartTime() time.Time

func (*CallCost) MatchCCFilter

func (cc *CallCost) MatchCCFilter(bf *BalanceFilter) bool

func (*CallCost) Merge

func (cc *CallCost) Merge(other *CallCost)

Merges the received timespan if they are similar (same activation period, same interval, same minute info.

func (*CallCost) Round

func (cc *CallCost) Round()

Round creates the RoundIncrements in timespans

func (*CallCost) ToDataCost

func (cc *CallCost) ToDataCost() (*DataCost, error)

func (*CallCost) UpdateCost

func (cc *CallCost) UpdateCost()

public function to update final (merged) callcost

func (*CallCost) UpdateRatedUsage

func (cc *CallCost) UpdateRatedUsage() time.Duration

type CallDescriptor

type CallDescriptor struct {
	Category        string
	Tenant          string
	Subject         string
	Account         string
	Destination     string
	TimeStart       time.Time
	TimeEnd         time.Time
	LoopIndex       float64       // indicates the position of this segment in a cost request loop
	DurationIndex   time.Duration // the call duration so far (till TimeEnd)
	FallbackSubject string        // the subject to check for destination if not found on primary subject
	RatingInfos     RatingInfos
	Increments      Increments
	ToR             string            // used unit balances selector
	ExtraFields     map[string]string // Extra fields, mostly used for user profile matching
	// session limits
	MaxRate             float64
	MaxRateUnit         time.Duration
	MaxCostSoFar        float64
	CgrID               string
	RunID               string
	ForceDuration       bool // for Max debit if less than duration return err
	PerformRounding     bool // flag for rating info rounding
	DenyNegativeAccount bool // prevent account going on negative during debit

	DryRun bool
	// contains filtered or unexported fields
}

The input stucture that contains call information.

func NewCallDescriptorFromCGREvent

func NewCallDescriptorFromCGREvent(cgrEv *utils.CGREvent,
	timezone string) (cd *CallDescriptor, err error)

NewCallDescriptorFromCGREvent converts a CGREvent into CallDescriptor

func (*CallDescriptor) AccountSummary

func (cd *CallDescriptor) AccountSummary(initialAcnt *AccountSummary) *AccountSummary

AccountSummary returns the AccountSummary for cached account

func (*CallDescriptor) AddRatingInfo

func (cd *CallDescriptor) AddRatingInfo(ris ...*RatingInfo)

Adds a rating plan that applyes to current call descriptor.

func (*CallDescriptor) AsCGREvent

func (cd *CallDescriptor) AsCGREvent(opts map[string]any) *utils.CGREvent

AsCGREvent converts the CallDescriptor into CGREvent

func (*CallDescriptor) Clone

func (cd *CallDescriptor) Clone() *CallDescriptor

func (*CallDescriptor) CreateCallCost

func (cd *CallDescriptor) CreateCallCost() *CallCost

Creates a CallCost structure copying related data from CallDescriptor

func (*CallDescriptor) Debit

func (cd *CallDescriptor) Debit(fltrS *FilterS) (cc *CallCost, err error)

func (*CallDescriptor) DebitMonetary added in v0.11.0

func (cd *CallDescriptor) DebitMonetary(fltrS *FilterS, cost float64) (cc *CallCost, err error)

func (*CallDescriptor) FieldAsInterface

func (cd *CallDescriptor) FieldAsInterface(fldPath []string) (fldVal any, err error)

FieldAsInterface is part of utils.DataProvider

func (*CallDescriptor) FieldAsString

func (cd *CallDescriptor) FieldAsString(fldPath []string) (fldVal string, err error)

FieldAsString is part of utils.DataProvider

func (*CallDescriptor) GetAccountKey

func (cd *CallDescriptor) GetAccountKey() string

GetAccountKey returns the key used to retrive the user balance involved in this call

func (*CallDescriptor) GetCost

func (cd *CallDescriptor) GetCost() (*CallCost, error)

Creates a CallCost structure with the cost information calculated for the received CallDescriptor.

func (*CallDescriptor) GetDuration

func (cd *CallDescriptor) GetDuration() time.Duration

Returns call descripor's total duration

func (*CallDescriptor) GetKey

func (cd *CallDescriptor) GetKey(subject string) string

GetKey constructs the key for the storage lookup. The prefixLen is limiting the length of the destination prefix.

func (*CallDescriptor) GetMaxSessionDuration

func (cd *CallDescriptor) GetMaxSessionDuration(fltrS *FilterS) (duration time.Duration, err error)

func (*CallDescriptor) LoadRatingPlans

func (cd *CallDescriptor) LoadRatingPlans() (err error)

Restores the activation periods for the specified prefix from storage.

func (*CallDescriptor) MaxDebit

func (cd *CallDescriptor) MaxDebit(fltrS *FilterS) (cc *CallCost, err error)

Interface method used to add/substract an amount of cents or bonus seconds (as returned by GetCost method) from user's money balance. This methods combines the Debit and GetMaxSessionDuration and will debit the max available time as returned by the GetMaxSessionDuration method. The amount filed has to be filled in call descriptor.

func (*CallDescriptor) RefundIncrements

func (cd *CallDescriptor) RefundIncrements(fltrS *FilterS) (acnt *Account, err error)

func (*CallDescriptor) RefundRounding

func (cd *CallDescriptor) RefundRounding(fltrS *FilterS) (acc *Account, err error)

func (*CallDescriptor) String

func (cd *CallDescriptor) String() string

String is part of utils.DataProvider

func (*CallDescriptor) UpdateFromCGREvent

func (cd *CallDescriptor) UpdateFromCGREvent(cgrEv *utils.CGREvent, fields []string) (err error)

UpdateFromCGREvent will update CallDescriptor with fields from CGREvent cgrEv contains both fields and their values fields represent fields needing update

func (*CallDescriptor) ValidateCallData

func (cd *CallDescriptor) ValidateCallData() error

type CallDescriptorWithAPIOpts added in v0.11.0

type CallDescriptorWithAPIOpts struct {
	*CallDescriptor
	APIOpts map[string]any
}

type Caps added in v0.11.0

type Caps struct {
	// contains filtered or unexported fields
}

Caps the structure that allocs requests for API

func NewCaps added in v0.11.0

func NewCaps(reqs int, strategy string) *Caps

NewCaps creates a new caps

func (*Caps) Allocate added in v0.11.0

func (cR *Caps) Allocate() (err error)

Allocate will reserve a channel for the API call

func (*Caps) Allocated added in v0.11.0

func (cR *Caps) Allocated() int

Allocated returns the number of requests actively serviced

func (*Caps) Deallocate added in v0.11.0

func (cR *Caps) Deallocate()

Deallocate will free a channel for the API call

func (*Caps) IsLimited added in v0.11.0

func (cR *Caps) IsLimited() bool

IsLimited returns true if the limit is not 0

type CapsStats added in v0.11.0

type CapsStats struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

CapsStats stores the stats for caps

func NewCapsStats added in v0.11.0

func NewCapsStats(sampleinterval time.Duration, caps *Caps, stopChan chan struct{}) (cs *CapsStats)

NewCapsStats returns the stats for the caps

func (*CapsStats) GetAverage added in v0.11.0

func (cs *CapsStats) GetAverage(roundingDecimals int) (avg float64)

GetAverage returns the average allocated caps

func (*CapsStats) GetPeak added in v0.11.0

func (cs *CapsStats) GetPeak() (peak int)

GetPeak returns the maximum allocated caps

func (*CapsStats) OnEvict added in v0.11.0

func (cs *CapsStats) OnEvict(itmID string, value any)

OnEvict the function that should be called on cache eviction

type CdrStorage

type CdrStorage interface {
	Storage
	SetCDR(*CDR, bool) error
	SetSMCost(smc *SMCost) error
	GetSMCosts(cgrid, runid, originHost, originIDPrfx string) ([]*SMCost, error)
	RemoveSMCost(*SMCost) error
	RemoveSMCosts(qryFltr *utils.SMCostFilter) error
	GetCDRs(*utils.CDRsFilter, bool) ([]*CDR, int64, error)
}

type ChargedRates

type ChargedRates map[string]RateGroups

ChargedRates the map with rateGroups

func (ChargedRates) Clone

func (crs ChargedRates) Clone() (cln ChargedRates)

Clone creates a copy of ChargedRates

func (ChargedRates) FieldAsInterface

func (crs ChargedRates) FieldAsInterface(fldPath []string) (val any, err error)

FieldAsInterface func to help EventCost FieldAsInterface

func (ChargedRates) GetIDWithSet

func (crs ChargedRates) GetIDWithSet(rg RateGroups) string

GetIDWithSet attempts to retrieve the UUID of a matching data or create a new one

type ChargedTiming

type ChargedTiming struct {
	Years     utils.Years
	Months    utils.Months
	MonthDays utils.MonthDays
	WeekDays  utils.WeekDays
	StartTime string
}

ChargedTiming represents one timing attached to a charge

func (*ChargedTiming) Clone

func (ct *ChargedTiming) Clone() (cln *ChargedTiming)

Clone creates a copy of ChargedTiming

func (*ChargedTiming) Equals

func (ct *ChargedTiming) Equals(oCT *ChargedTiming) bool

Equals returns if the timings are equal

func (ChargedTiming) FieldAsInterface

func (ct ChargedTiming) FieldAsInterface(fldPath []string) (val any, err error)

FieldAsInterface func to help EventCost FieldAsInterface

type ChargedTimings

type ChargedTimings map[string]*ChargedTiming

ChargedTimings the map of ChargedTiming

func (ChargedTimings) Clone

func (cts ChargedTimings) Clone() (cln ChargedTimings)

Clone creates a copy of ChargedTimings

func (ChargedTimings) FieldAsInterface

func (cts ChargedTimings) FieldAsInterface(fldPath []string) (val any, err error)

FieldAsInterface func to help EventCost FieldAsInterface

func (ChargedTimings) GetIDWithSet

func (cts ChargedTimings) GetIDWithSet(ct *ChargedTiming) string

GetIDWithSet attempts to retrieve the UUID of a matching data or create a new one

type ChargerMdl added in v0.11.0

type ChargerMdl struct {
	PK                 uint `gorm:"primary_key"`
	Tpid               string
	Tenant             string  `index:"0" re:".*"`
	ID                 string  `index:"1" re:".*"`
	FilterIDs          string  `index:"2" re:".*"`
	ActivationInterval string  `index:"3" re:".*"`
	RunID              string  `index:"4" re:".*"`
	AttributeIDs       string  `index:"5" re:".*"`
	Weight             float64 `index:"6" re:".*"`
	CreatedAt          time.Time
}

func (ChargerMdl) TableName added in v0.11.0

func (ChargerMdl) TableName() string

type ChargerMdls added in v0.11.0

type ChargerMdls []*ChargerMdl

func APItoModelTPCharger

func APItoModelTPCharger(tpCPP *utils.TPChargerProfile) (mdls ChargerMdls)

func (ChargerMdls) AsTPChargers added in v0.11.0

func (tps ChargerMdls) AsTPChargers() (result []*utils.TPChargerProfile)

func (ChargerMdls) CSVHeader added in v0.11.0

func (tps ChargerMdls) CSVHeader() (result []string)

CSVHeader return the header for csv fields as a slice of string

type ChargerProfile

type ChargerProfile struct {
	Tenant             string
	ID                 string
	FilterIDs          []string
	ActivationInterval *utils.ActivationInterval // Activation interval
	RunID              string
	AttributeIDs       []string // perform data aliasing based on these Attributes
	Weight             float64
}

ChargerProfile is the config for one Charger

func APItoChargerProfile

func APItoChargerProfile(tpCPP *utils.TPChargerProfile, timezone string) (cpp *ChargerProfile, err error)

func (*ChargerProfile) CacheClone added in v0.11.0

func (cp *ChargerProfile) CacheClone() any

CacheClone returns a clone of ChargerProfile used by ltcache CacheCloner

func (*ChargerProfile) Clone added in v0.11.0

func (cp *ChargerProfile) Clone() *ChargerProfile

Clone method for ChargerProfile

func (*ChargerProfile) TenantID

func (cP *ChargerProfile) TenantID() string

type ChargerProfileWithAPIOpts added in v0.11.0

type ChargerProfileWithAPIOpts struct {
	*ChargerProfile
	APIOpts map[string]any
}

ChargerProfileWithAPIOpts is used in replicatorV1 for dispatcher

type ChargerProfiles

type ChargerProfiles []*ChargerProfile

ChargerProfiles is a sortable list of Charger profiles

func (ChargerProfiles) Sort

func (cps ChargerProfiles) Sort()

Sort is part of sort interface, sort based on Weight

type ChargerService

type ChargerService struct {
	// contains filtered or unexported fields
}

ChargerService is performing charging

func NewChargerService

func NewChargerService(dm *DataManager, filterS *FilterS,
	cfg *config.CGRConfig, connMgr *ConnManager) *ChargerService

func (*ChargerService) Shutdown

func (cS *ChargerService) Shutdown()

Shutdown is called to shutdown the service

func (*ChargerService) V1GetChargersForEvent

func (cS *ChargerService) V1GetChargersForEvent(ctx *context.Context, args *utils.CGREvent,
	rply *ChargerProfiles) (err error)

V1GetChargersForEvent exposes the list of ordered matching ChargingProfiles for an event

func (*ChargerService) V1ProcessEvent

func (cS *ChargerService) V1ProcessEvent(ctx *context.Context, args *utils.CGREvent,
	reply *[]*ChrgSProcessEventReply) (err error)

V1ProcessEvent will process the event received via API and return list of events forked

type ChargingIncrement

type ChargingIncrement struct {
	Usage          time.Duration
	Cost           float64
	AccountingID   string
	CompressFactor int
}

ChargingIncrement represents one unit charged inside an interval

func (*ChargingIncrement) Clone

func (cIt *ChargingIncrement) Clone() (cln *ChargingIncrement)

Clone creates a copy of ChargingIncrement

func (*ChargingIncrement) Equals

func (cIt *ChargingIncrement) Equals(oCIt *ChargingIncrement) bool

Equals returns if the structure has the same value

func (*ChargingIncrement) FieldAsInterface

func (cIt *ChargingIncrement) FieldAsInterface(fldPath []string) (val any, err error)

FieldAsInterface func to help EventCost FieldAsInterface

func (*ChargingIncrement) PartiallyEquals

func (cIt *ChargingIncrement) PartiallyEquals(oCIt *ChargingIncrement) bool

PartiallyEquals ignores the CompressFactor when comparing

func (*ChargingIncrement) TotalCost

func (cIt *ChargingIncrement) TotalCost() float64

TotalCost returns the cost of the increment. DOES NOT have access to Accounting map to extract Factor. Therefore, TotalCost cannot be calculated.

func (*ChargingIncrement) TotalUsage

func (cIt *ChargingIncrement) TotalUsage() time.Duration

TotalUsage returns the total usage of the increment, considering compress factor

type ChargingInterval

type ChargingInterval struct {
	RatingID       string               // reference to RatingUnit
	Increments     []*ChargingIncrement // specific increments applied to this interval
	CompressFactor int
	// contains filtered or unexported fields
}

ChargingInterval represents one interval out of Usage providing charging info eg: PEAK vs OFFPEAK

func (*ChargingInterval) Clone

func (cIl *ChargingInterval) Clone() (cln *ChargingInterval)

Clone returns a new instance of ChargingInterval with independent data

func (*ChargingInterval) Cost

func (cIl *ChargingInterval) Cost() float64

Cost computes the total cost on this ChargingInterval

func (*ChargingInterval) EndTime

func (cIl *ChargingInterval) EndTime(cIlST time.Time) (et time.Time)

EndTime computes an EndTime based on ChargingInterval StartTime value and usage

func (*ChargingInterval) EventCostUsageIndex

func (cIl *ChargingInterval) EventCostUsageIndex() *time.Duration

EventCostUsageIndex publishes the value of ecUsageIdx

func (*ChargingInterval) PartiallyEquals

func (cIl *ChargingInterval) PartiallyEquals(oCIl *ChargingInterval) bool

PartiallyEquals does not compare CompressFactor, usefull for Merge

func (*ChargingInterval) StartTime

func (cIl *ChargingInterval) StartTime(ecST time.Time) (st time.Time)

StartTime computes a StartTime based on EventCost.Start time and ecUsageIdx

func (*ChargingInterval) TotalCost

func (cIl *ChargingInterval) TotalCost() float64

TotalCost returns the cost of charges

func (*ChargingInterval) TotalUsage

func (cIl *ChargingInterval) TotalUsage() (tu *time.Duration)

TotalUsage returns the total usage of this interval, considering compress factor

func (*ChargingInterval) Usage

func (cIl *ChargingInterval) Usage() *time.Duration

Usage computes the total usage of this ChargingInterval, ignoring CompressFactor

type ChrgSProcessEventReply

type ChrgSProcessEventReply struct {
	ChargerSProfile    string
	AttributeSProfiles []string
	AlteredFields      []string
	CGREvent           *utils.CGREvent
}

ChrgSProcessEventReply is the reply to processEvent

type ClearIPAllocationsArgs added in v0.11.0

type ClearIPAllocationsArgs struct {
	Tenant        string
	ID            string
	AllocationIDs []string
	APIOpts       map[string]any
}

ClearIPAllocationsArgs contains arguments for clearing IP allocations. If AllocationIDs is empty or nil, all allocations will be cleared.

type CodecMsgpackMarshaler

type CodecMsgpackMarshaler struct {
	// contains filtered or unexported fields
}

func NewCodecMsgpackMarshaler

func NewCodecMsgpackMarshaler() *CodecMsgpackMarshaler

func (*CodecMsgpackMarshaler) Marshal

func (cmm *CodecMsgpackMarshaler) Marshal(v any) (b []byte, err error)

func (*CodecMsgpackMarshaler) Unmarshal

func (cmm *CodecMsgpackMarshaler) Unmarshal(data []byte, v any) error

type CompressedCostCDR added in v0.11.0

type CompressedCostCDR struct {
	CGRID                 string
	RunID                 string
	OriginID              string
	OrderID               int64
	OriginHost            string
	Source                string
	ToR                   string
	RequestType           string
	Tenant                string
	Category              string
	Account               string
	Subject               string
	Destination           string
	SetupTime             time.Time
	AnswerTime            time.Time
	Usage                 time.Duration
	ExtraFields           map[string]string
	ExtraInfo             string
	Partial               bool
	PreRated              bool
	CostSource            string
	Cost                  float64
	CompressedCostDetails []byte
}

type ConnManager

type ConnManager struct {
	// contains filtered or unexported fields
}

ConnManager handle the RPC connections

func NewConnManager

func NewConnManager(cfg *config.CGRConfig, rpcInternal map[string]chan birpc.ClientConnector) (cM *ConnManager)

NewConnManager returns the Connection Manager

func (*ConnManager) Call

func (cM *ConnManager) Call(ctx *context.Context, connIDs []string, method string, arg, reply any) (err error)

Call gets the connection calls the method on it

func (*ConnManager) CallWithConnIDs added in v0.10.3

func (cM *ConnManager) CallWithConnIDs(connIDs []string, subsHostIDs utils.StringSet, method string, arg, reply any) (err error)

CallWithConnIDs will call the method only on specified rpcconns

func (*ConnManager) Reload added in v0.10.3

func (cM *ConnManager) Reload()

Reload will clear all RPC related caches

type CounterFilter

type CounterFilter struct {
	Value  float64
	Filter *BalanceFilter
}

func (*CounterFilter) Clone

func (cfs *CounterFilter) Clone() *CounterFilter

Clone clones *CounterFilter

func (*CounterFilter) FieldAsInterface added in v0.11.0

func (cfs *CounterFilter) FieldAsInterface(fldPath []string) (val any, err error)

func (*CounterFilter) FieldAsString added in v0.11.0

func (cfs *CounterFilter) FieldAsString(fldPath []string) (val string, err error)

func (*CounterFilter) String added in v0.11.0

func (cfs *CounterFilter) String() string

type CounterFilters

type CounterFilters []*CounterFilter

func (CounterFilters) HasCounter

func (cfs CounterFilters) HasCounter(cf *CounterFilter) bool

type DataCost

type DataCost struct {
	Category, Tenant, Subject, Account,
	Destination, ToR string
	Cost      float64
	DataSpans []*DataSpan
	// contains filtered or unexported fields
}

type used for showing sane data cost

type DataDB

type DataDB interface {
	Storage
	HasDataDrv(string, string, string) (bool, error)
	GetRatingPlanDrv(string) (*RatingPlan, error)
	SetRatingPlanDrv(*RatingPlan) error
	RemoveRatingPlanDrv(key string) (err error)
	GetRatingProfileDrv(string) (*RatingProfile, error)
	SetRatingProfileDrv(*RatingProfile) error
	RemoveRatingProfileDrv(string) error
	GetDestinationDrv(string, string) (*Destination, error)
	SetDestinationDrv(*Destination, string) error
	RemoveDestinationDrv(string, string) error
	RemoveReverseDestinationDrv(string, string, string) error
	SetReverseDestinationDrv(string, []string, string) error
	GetReverseDestinationDrv(string, string) ([]string, error)
	GetActionsDrv(string) (Actions, error)
	SetActionsDrv(string, Actions) error
	RemoveActionsDrv(string) error
	GetSharedGroupDrv(string) (*SharedGroup, error)
	SetSharedGroupDrv(*SharedGroup) error
	RemoveSharedGroupDrv(id string) (err error)
	GetActionTriggersDrv(string) (ActionTriggers, error)
	SetActionTriggersDrv(string, ActionTriggers) error
	RemoveActionTriggersDrv(string) error
	GetActionPlanDrv(string) (*ActionPlan, error)
	SetActionPlanDrv(string, *ActionPlan) error
	RemoveActionPlanDrv(key string) error
	GetAllActionPlansDrv() (map[string]*ActionPlan, error)
	GetAccountActionPlansDrv(acntID string) (apIDs []string, err error)
	SetAccountActionPlansDrv(acntID string, apIDs []string) (err error)
	RemAccountActionPlansDrv(acntID string) (err error)
	PushTask(*Task) error
	PopTask() (*Task, error)
	GetAccountDrv(string) (*Account, error)
	SetAccountDrv(*Account) error
	RemoveAccountDrv(string) error
	GetResourceProfileDrv(string, string) (*ResourceProfile, error)
	SetResourceProfileDrv(*ResourceProfile) error
	RemoveResourceProfileDrv(string, string) error
	GetResourceDrv(string, string) (*Resource, error)
	SetResourceDrv(*Resource) error
	RemoveResourceDrv(string, string) error
	GetIPProfileDrv(string, string) (*IPProfile, error)
	SetIPProfileDrv(*IPProfile) error
	RemoveIPProfileDrv(string, string) error
	GetIPAllocationsDrv(string, string) (*IPAllocations, error)
	SetIPAllocationsDrv(*IPAllocations) error
	RemoveIPAllocationsDrv(string, string) error
	GetTimingDrv(string) (*utils.TPTiming, error)
	SetTimingDrv(*utils.TPTiming) error
	RemoveTimingDrv(string) error
	GetLoadHistory(int, bool, string) ([]*utils.LoadInstance, error)
	AddLoadHistory(*utils.LoadInstance, int, string) error
	GetIndexesDrv(idxItmType, tntCtx string, idxKeys ...string) (indexes map[string]utils.StringSet, err error)
	SetIndexesDrv(idxItmType, tntCtx string,
		indexes map[string]utils.StringSet, commit bool, transactionID string) (err error)
	RemoveIndexesDrv(idxItmType, tntCtx string, idxKeys ...string) (err error)
	GetStatQueueProfileDrv(tenant string, ID string) (sq *StatQueueProfile, err error)
	SetStatQueueProfileDrv(sq *StatQueueProfile) (err error)
	RemStatQueueProfileDrv(tenant, id string) (err error)
	GetStatQueueDrv(tenant, id string) (sq *StatQueue, err error)
	SetStatQueueDrv(ssq *StoredStatQueue, sq *StatQueue) (err error)
	RemStatQueueDrv(tenant, id string) (err error)
	SetRankingProfileDrv(sq *RankingProfile) (err error)
	GetRankingProfileDrv(tenant string, id string) (sq *RankingProfile, err error)
	RemRankingProfileDrv(tenant string, id string) (err error)
	GetRankingDrv(string, string) (*Ranking, error)
	SetRankingDrv(*Ranking) error
	RemoveRankingDrv(string, string) error
	SetTrendProfileDrv(tr *TrendProfile) (err error)
	GetTrendProfileDrv(tenant string, id string) (sq *TrendProfile, err error)
	RemTrendProfileDrv(tenant string, id string) (err error)
	GetTrendDrv(string, string) (*Trend, error)
	SetTrendDrv(*Trend) error
	RemoveTrendDrv(string, string) error
	GetThresholdProfileDrv(tenant string, ID string) (tp *ThresholdProfile, err error)
	SetThresholdProfileDrv(tp *ThresholdProfile) (err error)
	RemThresholdProfileDrv(tenant, id string) (err error)
	GetThresholdDrv(string, string) (*Threshold, error)
	SetThresholdDrv(*Threshold) error
	RemoveThresholdDrv(string, string) error
	GetFilterDrv(string, string) (*Filter, error)
	SetFilterDrv(*Filter) error
	RemoveFilterDrv(string, string) error
	GetRouteProfileDrv(string, string) (*RouteProfile, error)
	SetRouteProfileDrv(*RouteProfile) error
	RemoveRouteProfileDrv(string, string) error
	GetAttributeProfileDrv(string, string) (*AttributeProfile, error)
	SetAttributeProfileDrv(*AttributeProfile) error
	RemoveAttributeProfileDrv(string, string) error
	GetChargerProfileDrv(string, string) (*ChargerProfile, error)
	SetChargerProfileDrv(*ChargerProfile) error
	RemoveChargerProfileDrv(string, string) error
	GetDispatcherProfileDrv(string, string) (*DispatcherProfile, error)
	SetDispatcherProfileDrv(*DispatcherProfile) error
	RemoveDispatcherProfileDrv(string, string) error
	GetItemLoadIDsDrv(itemIDPrefix string) (loadIDs map[string]int64, err error)
	SetLoadIDsDrv(loadIDs map[string]int64) error
	RemoveLoadIDsDrv() error
	GetDispatcherHostDrv(string, string) (*DispatcherHost, error)
	SetDispatcherHostDrv(*DispatcherHost) error
	RemoveDispatcherHostDrv(string, string) error
	SetBackupSessionsDrv(nodeID string, tenant string, sessions []*StoredSession) error
	GetSessionsBackupDrv(nodeID string, tenant string) ([]*StoredSession, error)
	RemoveSessionsBackupDrv(nodeID, tenant, cgrid string) error
	DumpDataDB() error
	RewriteDataDB() error
	BackupDataDB(string, bool) error
	RestoreDataDB(string) error
	SnapshotDataDB(string, bool) error
}

OnlineStorage contains methods to use for administering online data

func NewDataDBConn

func NewDataDBConn(dbType, host, port, name, user,
	pass, marshaler string, opts *config.DataDBOpts,
	itmsCfg map[string]*config.ItemOpt) (d DataDB, err error)

NewDataDBConn creates a DataDB connection

type DataDBMock added in v0.11.0

type DataDBMock struct {
	GetKeysForPrefixF         func(string, string) ([]string, error)
	GetChargerProfileDrvF     func(string, string) (*ChargerProfile, error)
	GetFilterDrvF             func(string, string) (*Filter, error)
	GetIndexesDrvF            func(idxItmType, tntCtx string, idxKeys ...string) (indexes map[string]utils.StringSet, err error)
	GetThresholdProfileDrvF   func(tenant, id string) (tp *ThresholdProfile, err error)
	SetThresholdProfileDrvF   func(tp *ThresholdProfile) (err error)
	RemThresholdProfileDrvF   func(tenant, id string) (err error)
	GetThresholdDrvF          func(tenant, id string) (*Threshold, error)
	GetResourceProfileDrvF    func(tnt, id string) (*ResourceProfile, error)
	SetResourceProfileDrvF    func(rp *ResourceProfile) error
	RemoveResourceProfileDrvF func(tnt, id string) error
	SetResourceDrvF           func(r *Resource) error
	GetIPProfileDrvF          func(tnt, id string) (*IPProfile, error)
	SetIPProfileDrvF          func(ipp *IPProfile) error
	RemoveIPProfileDrvF       func(tnt, id string) error
	SetIPAllocationsDrvF      func(ip *IPAllocations) error
	GetStatQueueProfileDrvF   func(tenant, id string) (sq *StatQueueProfile, err error)
	SetStatQueueProfileDrvF   func(sq *StatQueueProfile) (err error)
	RemStatQueueProfileDrvF   func(tenant, id string) (err error)
	SetRankingProfileDrvF     func(sq *RankingProfile) (err error)
	GetRankingProfileDrvF     func(tenant string, id string) (sq *RankingProfile, err error)
	RemRankingProfileDrvF     func(tenant string, id string) (err error)
	SetTrendProfileDrvF       func(sq *TrendProfile) (err error)
	GetTrendProfileDrvF       func(tenant string, id string) (sq *TrendProfile, err error)
	RemTrendProfileDrvF       func(tenant string, id string) (err error)
	GetActionPlanDrvF         func(key string) (ap *ActionPlan, err error)
	SetActionPlanDrvF         func(key string, ap *ActionPlan) (err error)
	RemoveActionPlanDrvF      func(key string) (err error)
	GetRouteProfileDrvF       func(tenant, id string) (rp *RouteProfile, err error)
	RemoveRouteProfileDrvF    func(tenant, id string) error
	GetAccountDrvF            func(id string) (*Account, error)
	SetAccountDrvF            func(acc *Account) error
	RemoveAccountDrvF         func(id string) error
}

func (*DataDBMock) AddLoadHistory added in v0.11.0

func (dbM *DataDBMock) AddLoadHistory(*utils.LoadInstance, int, string) error

func (*DataDBMock) BackupDataDB added in v0.11.0

func (dbM *DataDBMock) BackupDataDB(backupFolderPath string, zip bool) (err error)

func (*DataDBMock) Close added in v0.11.0

func (dbM *DataDBMock) Close()

Storage methods

func (*DataDBMock) DumpDataDB added in v0.11.0

func (dbM *DataDBMock) DumpDataDB() error

func (*DataDBMock) Flush added in v0.11.0

func (dbM *DataDBMock) Flush(string) error

func (*DataDBMock) GetAccountActionPlansDrv added in v0.11.0

func (dbM *DataDBMock) GetAccountActionPlansDrv(acntID string) (apIDs []string, err error)

func (*DataDBMock) GetAccountDrv added in v0.11.0

func (dbM *DataDBMock) GetAccountDrv(id string) (*Account, error)

func (*DataDBMock) GetActionPlanDrv added in v0.11.0

func (dbM *DataDBMock) GetActionPlanDrv(key string) (*ActionPlan, error)

func (*DataDBMock) GetActionTriggersDrv added in v0.11.0

func (dbM *DataDBMock) GetActionTriggersDrv(string) (ActionTriggers, error)

func (*DataDBMock) GetActionsDrv added in v0.11.0

func (dbM *DataDBMock) GetActionsDrv(string) (Actions, error)

func (*DataDBMock) GetAllActionPlansDrv added in v0.11.0

func (dbM *DataDBMock) GetAllActionPlansDrv() (map[string]*ActionPlan, error)

func (*DataDBMock) GetAttributeProfileDrv added in v0.11.0

func (dbM *DataDBMock) GetAttributeProfileDrv(string, string) (*AttributeProfile, error)

func (*DataDBMock) GetChargerProfileDrv added in v0.11.0

func (dbM *DataDBMock) GetChargerProfileDrv(tnt string, id string) (*ChargerProfile, error)

func (*DataDBMock) GetDestinationDrv added in v0.11.0

func (dbM *DataDBMock) GetDestinationDrv(string, string) (*Destination, error)

func (*DataDBMock) GetDispatcherHostDrv added in v0.11.0

func (dbM *DataDBMock) GetDispatcherHostDrv(string, string) (*DispatcherHost, error)

func (*DataDBMock) GetDispatcherProfileDrv added in v0.11.0

func (dbM *DataDBMock) GetDispatcherProfileDrv(string, string) (*DispatcherProfile, error)

func (*DataDBMock) GetFilterDrv added in v0.11.0

func (dbM *DataDBMock) GetFilterDrv(tnt string, id string) (*Filter, error)

func (*DataDBMock) GetIPAllocationsDrv added in v0.11.0

func (dbM *DataDBMock) GetIPAllocationsDrv(string, string) (*IPAllocations, error)

func (*DataDBMock) GetIPProfileDrv added in v0.11.0

func (dbM *DataDBMock) GetIPProfileDrv(tnt, id string) (*IPProfile, error)

func (*DataDBMock) GetIndexesDrv added in v0.11.0

func (dbM *DataDBMock) GetIndexesDrv(idxItmType, tntCtx string, idxKeys ...string) (indexes map[string]utils.StringSet, err error)

func (*DataDBMock) GetItemLoadIDsDrv added in v0.11.0

func (dbM *DataDBMock) GetItemLoadIDsDrv(itemIDPrefix string) (loadIDs map[string]int64, err error)

func (*DataDBMock) GetKeysForPrefix added in v0.11.0

func (dbM *DataDBMock) GetKeysForPrefix(prf string, srch string) ([]string, error)

func (*DataDBMock) GetLoadHistory added in v0.11.0

func (dbM *DataDBMock) GetLoadHistory(int, bool, string) ([]*utils.LoadInstance, error)

func (*DataDBMock) GetRankingDrv added in v0.11.0

func (dbM *DataDBMock) GetRankingDrv(tenant, id string) (*Ranking, error)

func (*DataDBMock) GetRankingProfileDrv added in v0.11.0

func (dbM *DataDBMock) GetRankingProfileDrv(tenant, id string) (sg *RankingProfile, err error)

func (*DataDBMock) GetRatingPlanDrv added in v0.11.0

func (dbM *DataDBMock) GetRatingPlanDrv(string) (*RatingPlan, error)

func (*DataDBMock) GetRatingProfileDrv added in v0.11.0

func (dbM *DataDBMock) GetRatingProfileDrv(string) (*RatingProfile, error)

func (*DataDBMock) GetResourceDrv added in v0.11.0

func (dbM *DataDBMock) GetResourceDrv(string, string) (*Resource, error)

func (*DataDBMock) GetResourceProfileDrv added in v0.11.0

func (dbM *DataDBMock) GetResourceProfileDrv(tnt, id string) (*ResourceProfile, error)

func (*DataDBMock) GetReverseDestinationDrv added in v0.11.0

func (dbM *DataDBMock) GetReverseDestinationDrv(string, string) ([]string, error)

func (*DataDBMock) GetRouteProfileDrv added in v0.11.0

func (dbM *DataDBMock) GetRouteProfileDrv(tenant, id string) (*RouteProfile, error)

func (*DataDBMock) GetSessionsBackupDrv added in v0.11.0

func (dbM *DataDBMock) GetSessionsBackupDrv(nodeID string, tnt string) ([]*StoredSession, error)

func (*DataDBMock) GetSharedGroupDrv added in v0.11.0

func (dbM *DataDBMock) GetSharedGroupDrv(string) (*SharedGroup, error)

func (*DataDBMock) GetStatQueueDrv added in v0.11.0

func (dbM *DataDBMock) GetStatQueueDrv(tenant, id string) (sq *StatQueue, err error)

func (*DataDBMock) GetStatQueueProfileDrv added in v0.11.0

func (dbM *DataDBMock) GetStatQueueProfileDrv(tenant, id string) (sq *StatQueueProfile, err error)

func (*DataDBMock) GetStorageType added in v0.11.0

func (dbM *DataDBMock) GetStorageType() string

func (*DataDBMock) GetThresholdDrv added in v0.11.0

func (dbM *DataDBMock) GetThresholdDrv(tenant, id string) (*Threshold, error)

func (*DataDBMock) GetThresholdProfileDrv added in v0.11.0

func (dbM *DataDBMock) GetThresholdProfileDrv(tenant, id string) (tp *ThresholdProfile, err error)

func (*DataDBMock) GetTimingDrv added in v0.11.0

func (dbM *DataDBMock) GetTimingDrv(string) (*utils.TPTiming, error)

func (*DataDBMock) GetTrendDrv added in v0.11.0

func (dbM *DataDBMock) GetTrendDrv(tenant, id string) (*Trend, error)

func (*DataDBMock) GetTrendProfileDrv added in v0.11.0

func (dbM *DataDBMock) GetTrendProfileDrv(tenant, id string) (sg *TrendProfile, err error)

func (*DataDBMock) GetVersions added in v0.11.0

func (dbM *DataDBMock) GetVersions(itm string) (vrs Versions, err error)

func (*DataDBMock) HasDataDrv added in v0.11.0

func (dbM *DataDBMock) HasDataDrv(string, string, string) (bool, error)

DataDB methods

func (*DataDBMock) IsDBEmpty added in v0.11.0

func (dbM *DataDBMock) IsDBEmpty() (resp bool, err error)

func (*DataDBMock) PopTask added in v0.11.0

func (dbM *DataDBMock) PopTask() (*Task, error)

func (*DataDBMock) PushTask added in v0.11.0

func (dbM *DataDBMock) PushTask(*Task) error

func (*DataDBMock) RemAccountActionPlansDrv added in v0.11.0

func (dbM *DataDBMock) RemAccountActionPlansDrv(acntID string) (err error)

func (*DataDBMock) RemRankingProfileDrv added in v0.11.0

func (dbM *DataDBMock) RemRankingProfileDrv(tenant string, id string) (err error)

func (*DataDBMock) RemStatQueueDrv added in v0.11.0

func (dbM *DataDBMock) RemStatQueueDrv(tenant, id string) (err error)

func (*DataDBMock) RemStatQueueProfileDrv added in v0.11.0

func (dbM *DataDBMock) RemStatQueueProfileDrv(tenant, id string) (err error)

func (*DataDBMock) RemThresholdProfileDrv added in v0.11.0

func (dbM *DataDBMock) RemThresholdProfileDrv(tenant, id string) (err error)

func (*DataDBMock) RemTrendProfileDrv added in v0.11.0

func (dbM *DataDBMock) RemTrendProfileDrv(tenant string, id string) (err error)

func (*DataDBMock) RemoveAccountDrv added in v0.11.0

func (dbM *DataDBMock) RemoveAccountDrv(id string) error

func (*DataDBMock) RemoveActionPlanDrv added in v0.11.0

func (dbM *DataDBMock) RemoveActionPlanDrv(key string) error

func (*DataDBMock) RemoveActionTriggersDrv added in v0.11.0

func (dbM *DataDBMock) RemoveActionTriggersDrv(string) error

func (*DataDBMock) RemoveActionsDrv added in v0.11.0

func (dbM *DataDBMock) RemoveActionsDrv(string) error

func (*DataDBMock) RemoveAttributeProfileDrv added in v0.11.0

func (dbM *DataDBMock) RemoveAttributeProfileDrv(string, string) error

func (*DataDBMock) RemoveChargerProfileDrv added in v0.11.0

func (dbM *DataDBMock) RemoveChargerProfileDrv(string, string) error

func (*DataDBMock) RemoveDestinationDrv added in v0.11.0

func (dbM *DataDBMock) RemoveDestinationDrv(string, string) error

func (*DataDBMock) RemoveDispatcherHostDrv added in v0.11.0

func (dbM *DataDBMock) RemoveDispatcherHostDrv(string, string) error

func (*DataDBMock) RemoveDispatcherProfileDrv added in v0.11.0

func (dbM *DataDBMock) RemoveDispatcherProfileDrv(string, string) error

func (*DataDBMock) RemoveFilterDrv added in v0.11.0

func (dbM *DataDBMock) RemoveFilterDrv(string, string) error

func (*DataDBMock) RemoveIPAllocationsDrv added in v0.11.0

func (dbM *DataDBMock) RemoveIPAllocationsDrv(string, string) error

func (*DataDBMock) RemoveIPProfileDrv added in v0.11.0

func (dbM *DataDBMock) RemoveIPProfileDrv(tnt, id string) error

func (*DataDBMock) RemoveIndexesDrv added in v0.11.0

func (dbM *DataDBMock) RemoveIndexesDrv(idxItmType, tntCtx string, idxKeys ...string) (err error)

func (*DataDBMock) RemoveKeysForPrefix added in v0.11.0

func (dbM *DataDBMock) RemoveKeysForPrefix(string) error

func (*DataDBMock) RemoveLoadIDsDrv added in v0.11.0

func (dbM *DataDBMock) RemoveLoadIDsDrv() error

func (*DataDBMock) RemoveRankingDrv added in v0.11.0

func (dbM *DataDBMock) RemoveRankingDrv(string, string) error

func (*DataDBMock) RemoveRatingPlanDrv added in v0.11.0

func (dbM *DataDBMock) RemoveRatingPlanDrv(key string) (err error)

func (*DataDBMock) RemoveRatingProfileDrv added in v0.11.0

func (dbM *DataDBMock) RemoveRatingProfileDrv(string) error

func (*DataDBMock) RemoveResourceDrv added in v0.11.0

func (dbM *DataDBMock) RemoveResourceDrv(string, string) error

func (*DataDBMock) RemoveResourceProfileDrv added in v0.11.0

func (dbM *DataDBMock) RemoveResourceProfileDrv(tnt, id string) error

func (*DataDBMock) RemoveReverseDestinationDrv added in v0.11.0

func (dbM *DataDBMock) RemoveReverseDestinationDrv(string, string, string) error

func (*DataDBMock) RemoveRouteProfileDrv added in v0.11.0

func (dbM *DataDBMock) RemoveRouteProfileDrv(tenant, id string) error

func (*DataDBMock) RemoveSessionsBackupDrv added in v0.11.0

func (dbM *DataDBMock) RemoveSessionsBackupDrv(nodeID, tnt, cgrid string) error

func (*DataDBMock) RemoveSharedGroupDrv added in v0.11.0

func (dbM *DataDBMock) RemoveSharedGroupDrv(id string) (err error)

func (*DataDBMock) RemoveThresholdDrv added in v0.11.0

func (dbM *DataDBMock) RemoveThresholdDrv(string, string) error

func (*DataDBMock) RemoveTimingDrv added in v0.11.0

func (dbM *DataDBMock) RemoveTimingDrv(string) error

func (*DataDBMock) RemoveTrendDrv added in v0.11.0

func (dbM *DataDBMock) RemoveTrendDrv(string, string) error

func (*DataDBMock) RemoveVersions added in v0.11.0

func (dbM *DataDBMock) RemoveVersions(vrs Versions) (err error)

func (*DataDBMock) RestoreDataDB added in v0.11.0

func (dbM *DataDBMock) RestoreDataDB(backupFolderPath string) (err error)

func (*DataDBMock) RewriteDataDB added in v0.11.0

func (dbM *DataDBMock) RewriteDataDB() (err error)

func (*DataDBMock) SetAccountActionPlansDrv added in v0.11.0

func (dbM *DataDBMock) SetAccountActionPlansDrv(acntID string, apIDs []string) (err error)

func (*DataDBMock) SetAccountDrv added in v0.11.0

func (dbM *DataDBMock) SetAccountDrv(acc *Account) error

func (*DataDBMock) SetActionPlanDrv added in v0.11.0

func (dbM *DataDBMock) SetActionPlanDrv(key string, ap *ActionPlan) error

func (*DataDBMock) SetActionTriggersDrv added in v0.11.0

func (dbM *DataDBMock) SetActionTriggersDrv(string, ActionTriggers) error

func (*DataDBMock) SetActionsDrv added in v0.11.0

func (dbM *DataDBMock) SetActionsDrv(string, Actions) error

func (*DataDBMock) SetAttributeProfileDrv added in v0.11.0

func (dbM *DataDBMock) SetAttributeProfileDrv(*AttributeProfile) error

func (*DataDBMock) SetBackupSessionsDrv added in v0.11.0

func (dbM *DataDBMock) SetBackupSessionsDrv(nodeID string, tnt string, storedSessions []*StoredSession) error

func (*DataDBMock) SetChargerProfileDrv added in v0.11.0

func (dbM *DataDBMock) SetChargerProfileDrv(*ChargerProfile) error

func (*DataDBMock) SetDestinationDrv added in v0.11.0

func (dbM *DataDBMock) SetDestinationDrv(*Destination, string) error

func (*DataDBMock) SetDispatcherHostDrv added in v0.11.0

func (dbM *DataDBMock) SetDispatcherHostDrv(*DispatcherHost) error

func (*DataDBMock) SetDispatcherProfileDrv added in v0.11.0

func (dbM *DataDBMock) SetDispatcherProfileDrv(*DispatcherProfile) error

func (*DataDBMock) SetFilterDrv added in v0.11.0

func (dbM *DataDBMock) SetFilterDrv(*Filter) error

func (*DataDBMock) SetIPAllocationsDrv added in v0.11.0

func (dbM *DataDBMock) SetIPAllocationsDrv(ip *IPAllocations) error

func (*DataDBMock) SetIPProfileDrv added in v0.11.0

func (dbM *DataDBMock) SetIPProfileDrv(ipp *IPProfile) error

func (*DataDBMock) SetIndexesDrv added in v0.11.0

func (dbM *DataDBMock) SetIndexesDrv(idxItmType, tntCtx string,
	indexes map[string]utils.StringSet, commit bool, transactionID string) (err error)

func (*DataDBMock) SetLoadIDsDrv added in v0.11.0

func (dbM *DataDBMock) SetLoadIDsDrv(loadIDs map[string]int64) error

func (*DataDBMock) SetRankingDrv added in v0.11.0

func (dbM *DataDBMock) SetRankingDrv(*Ranking) error

func (*DataDBMock) SetRankingProfileDrv added in v0.11.0

func (dbM *DataDBMock) SetRankingProfileDrv(sg *RankingProfile) (err error)

func (*DataDBMock) SetRatingPlanDrv added in v0.11.0

func (dbM *DataDBMock) SetRatingPlanDrv(*RatingPlan) error

func (*DataDBMock) SetRatingProfileDrv added in v0.11.0

func (dbM *DataDBMock) SetRatingProfileDrv(*RatingProfile) error

func (*DataDBMock) SetResourceDrv added in v0.11.0

func (dbM *DataDBMock) SetResourceDrv(r *Resource) error

func (*DataDBMock) SetResourceProfileDrv added in v0.11.0

func (dbM *DataDBMock) SetResourceProfileDrv(rp *ResourceProfile) error

func (*DataDBMock) SetReverseDestinationDrv added in v0.11.0

func (dbM *DataDBMock) SetReverseDestinationDrv(string, []string, string) error

func (*DataDBMock) SetRouteProfileDrv added in v0.11.0

func (dbM *DataDBMock) SetRouteProfileDrv(*RouteProfile) error

func (*DataDBMock) SetSharedGroupDrv added in v0.11.0

func (dbM *DataDBMock) SetSharedGroupDrv(*SharedGroup) error

func (*DataDBMock) SetStatQueueDrv added in v0.11.0

func (dbM *DataDBMock) SetStatQueueDrv(ssq *StoredStatQueue, sq *StatQueue) (err error)

func (*DataDBMock) SetStatQueueProfileDrv added in v0.11.0

func (dbM *DataDBMock) SetStatQueueProfileDrv(sq *StatQueueProfile) (err error)

func (*DataDBMock) SetThresholdDrv added in v0.11.0

func (dbM *DataDBMock) SetThresholdDrv(*Threshold) error

func (*DataDBMock) SetThresholdProfileDrv added in v0.11.0

func (dbM *DataDBMock) SetThresholdProfileDrv(tp *ThresholdProfile) (err error)

func (*DataDBMock) SetTimingDrv added in v0.11.0

func (dbM *DataDBMock) SetTimingDrv(*utils.TPTiming) error

func (*DataDBMock) SetTrendDrv added in v0.11.0

func (dbM *DataDBMock) SetTrendDrv(*Trend) error

func (*DataDBMock) SetTrendProfileDrv added in v0.11.0

func (dbM *DataDBMock) SetTrendProfileDrv(trend *TrendProfile) (err error)

func (*DataDBMock) SetVersions added in v0.11.0

func (dbM *DataDBMock) SetVersions(vrs Versions, overwrite bool) (err error)

func (*DataDBMock) SnapshotDataDB added in v0.11.0

func (dbM *DataDBMock) SnapshotDataDB(backupFolderPath string, zip bool) (err error)

type DataIncrement

type DataIncrement struct {
	Amount         float64
	Cost           float64
	BalanceInfo    *DebitInfo // need more than one for units with cost
	CompressFactor int
}

type DataManager

type DataManager struct {
	// contains filtered or unexported fields
}

DataManager is the data storage manager for CGRateS transparently manages data retrieval, further serialization and caching

func NewDataManager

func NewDataManager(dataDB DataDB, cacheCfg *config.CacheCfg, connMgr *ConnManager) *DataManager

NewDataManager returns a new DataManager

func (*DataManager) CacheDataFromDB

func (dm *DataManager) CacheDataFromDB(prfx string, ids []string, mustBeCached bool) (err error)

func (*DataManager) Close added in v0.11.0

func (dm *DataManager) Close()

func (*DataManager) DataDB

func (dm *DataManager) DataDB() DataDB

DataDB exports access to dataDB

func (*DataManager) GetAPIBan added in v0.11.0

func (dm *DataManager) GetAPIBan(ip string, apiKeys []string, single, cacheRead, cacheWrite bool) (banned bool, err error)

func (*DataManager) GetAccount

func (dm *DataManager) GetAccount(id string) (acc *Account, err error)

func (*DataManager) GetAccountActionPlans

func (dm *DataManager) GetAccountActionPlans(acntID string, cacheRead, cacheWrite bool, transactionID string) (apIDs []string, err error)

func (*DataManager) GetActionPlan

func (dm *DataManager) GetActionPlan(key string, cacheRead, cacheWrite bool, transactionID string) (ats *ActionPlan, err error)

func (*DataManager) GetActionTriggers

func (dm *DataManager) GetActionTriggers(id string, skipCache bool,
	transactionID string) (attrs ActionTriggers, err error)

func (*DataManager) GetActions

func (dm *DataManager) GetActions(key string, skipCache bool, transactionID string) (as Actions, err error)

func (*DataManager) GetAllActionPlans

func (dm *DataManager) GetAllActionPlans() (ats map[string]*ActionPlan, err error)

func (*DataManager) GetAttributeProfile

func (dm *DataManager) GetAttributeProfile(tenant, id string, cacheRead, cacheWrite bool,
	transactionID string) (attrPrfl *AttributeProfile, err error)

GetAttributeProfile returns the AttributeProfile with the given id

func (*DataManager) GetChargerProfile

func (dm *DataManager) GetChargerProfile(tenant, id string, cacheRead, cacheWrite bool,
	transactionID string) (cpp *ChargerProfile, err error)

func (*DataManager) GetDestination

func (dm *DataManager) GetDestination(key string, cacheRead, cacheWrite bool, transactionID string) (dest *Destination, err error)

func (*DataManager) GetDispatcherHost

func (dm *DataManager) GetDispatcherHost(tenant, id string, cacheRead, cacheWrite bool,
	transactionID string) (dH *DispatcherHost, err error)

func (*DataManager) GetDispatcherProfile

func (dm *DataManager) GetDispatcherProfile(tenant, id string, cacheRead, cacheWrite bool,
	transactionID string) (dpp *DispatcherProfile, err error)

func (*DataManager) GetFilter added in v0.11.0

func (dm *DataManager) GetFilter(tenant, id string, cacheRead, cacheWrite bool,
	transactionID string) (fltr *Filter, err error)

GetFilter returns a filter based on the given ID

func (*DataManager) GetIPAllocations added in v0.11.0

func (dm *DataManager) GetIPAllocations(tenant, id string, cacheRead, cacheWrite bool,
	transactionID string, prfl *IPProfile) (ip *IPAllocations, err error)

func (*DataManager) GetIPProfile added in v0.11.0

func (dm *DataManager) GetIPProfile(tenant, id string, cacheRead, cacheWrite bool,
	transactionID string) (ipp *IPProfile, err error)

func (*DataManager) GetIndexes added in v0.11.0

func (dm *DataManager) GetIndexes(idxItmType, tntCtx string, cacheRead, cacheWrite bool,
	idxKeys ...string) (indexes map[string]utils.StringSet, err error)

GetIndexes retrieves the specified index keys.

func (*DataManager) GetItemLoadIDs

func (dm *DataManager) GetItemLoadIDs(itemIDPrefix string, cacheWrite bool) (loadIDs map[string]int64, err error)

func (*DataManager) GetRanking added in v0.11.0

func (dm *DataManager) GetRanking(tenant, id string, cacheRead, cacheWrite bool, transactionID string) (rn *Ranking, err error)

func (*DataManager) GetRankingProfile added in v0.11.0

func (dm *DataManager) GetRankingProfile(tenant, id string, cacheRead, cacheWrite bool, transactionID string) (rgp *RankingProfile, err error)

func (*DataManager) GetRankingProfileIDs added in v0.11.0

func (dm *DataManager) GetRankingProfileIDs(tenants []string) (rns map[string][]string, err error)

func (*DataManager) GetRatingPlan

func (dm *DataManager) GetRatingPlan(key string, skipCache bool,
	transactionID string) (rp *RatingPlan, err error)

func (*DataManager) GetRatingProfile

func (dm *DataManager) GetRatingProfile(key string, skipCache bool,
	transactionID string) (rpf *RatingProfile, err error)

GetRatingProfile returns the RatingProfile for the key

func (*DataManager) GetResource

func (dm *DataManager) GetResource(tenant, id string, cacheRead, cacheWrite bool,
	transactionID string) (rs *Resource, err error)

func (*DataManager) GetResourceProfile

func (dm *DataManager) GetResourceProfile(tenant, id string, cacheRead, cacheWrite bool,
	transactionID string) (rp *ResourceProfile, err error)

func (*DataManager) GetReverseDestination

func (dm *DataManager) GetReverseDestination(prefix string,
	cacheRead, cacheWrite bool, transactionID string) (ids []string, err error)

func (*DataManager) GetRouteProfile added in v0.11.0

func (dm *DataManager) GetRouteProfile(tenant, id string, cacheRead, cacheWrite bool,
	transactionID string) (rpp *RouteProfile, err error)

func (*DataManager) GetSessionsBackup added in v0.11.0

func (dm *DataManager) GetSessionsBackup(nodeID, tenant string) ([]*StoredSession, error)

GetSessionsBackup gets sessions from dataDB backup

func (*DataManager) GetSharedGroup

func (dm *DataManager) GetSharedGroup(key string, skipCache bool,
	transactionID string) (sg *SharedGroup, err error)

func (*DataManager) GetStatQueue

func (dm *DataManager) GetStatQueue(tenant, id string,
	cacheRead, cacheWrite bool, transactionID string) (sq *StatQueue, err error)

GetStatQueue retrieves a StatQueue from dataDB handles caching and deserialization of metrics

func (*DataManager) GetStatQueueProfile

func (dm *DataManager) GetStatQueueProfile(tenant, id string, cacheRead, cacheWrite bool,
	transactionID string) (sqp *StatQueueProfile, err error)

func (*DataManager) GetThreshold

func (dm *DataManager) GetThreshold(tenant, id string,
	cacheRead, cacheWrite bool, transactionID string) (th *Threshold, err error)

func (*DataManager) GetThresholdProfile

func (dm *DataManager) GetThresholdProfile(tenant, id string, cacheRead, cacheWrite bool,
	transactionID string) (th *ThresholdProfile, err error)

func (*DataManager) GetTiming

func (dm *DataManager) GetTiming(id string, skipCache bool,
	transactionID string) (t *utils.TPTiming, err error)

func (*DataManager) GetTrend added in v0.11.0

func (dm *DataManager) GetTrend(tenant, id string,
	cacheRead, cacheWrite bool, transactionID string) (tr *Trend, err error)

GetTrend retrieves a Trend from dataDB

func (*DataManager) GetTrendProfile added in v0.11.0

func (dm *DataManager) GetTrendProfile(tenant, id string, cacheRead, cacheWrite bool,
	transactionID string) (trp *TrendProfile, err error)

func (*DataManager) GetTrendProfileIDs added in v0.11.0

func (dm *DataManager) GetTrendProfileIDs(tenants []string) (tps map[string][]string, err error)

func (*DataManager) HasData

func (dm *DataManager) HasData(category, subject, tenant string) (has bool, err error)

func (*DataManager) RebuildReverseForPrefix added in v0.10.3

func (dm *DataManager) RebuildReverseForPrefix(prefix string) (err error)

func (*DataManager) Reconnect

func (dm *DataManager) Reconnect(marshaller string, newcfg *config.DataDbCfg, itmsCfg map[string]*config.ItemOpt) (err error)

Reconnect reconnects to the DB when the config was changed

func (*DataManager) RemAccountActionPlans

func (dm *DataManager) RemAccountActionPlans(acntID string, apIDs []string) (err error)

func (*DataManager) RemoveAccount

func (dm *DataManager) RemoveAccount(id string) error

func (*DataManager) RemoveActionPlan

func (dm *DataManager) RemoveActionPlan(key string, transactionID string) (err error)

func (*DataManager) RemoveActionTriggers

func (dm *DataManager) RemoveActionTriggers(id, transactionID string) (err error)

func (*DataManager) RemoveActions

func (dm *DataManager) RemoveActions(key string) (err error)

func (*DataManager) RemoveAttributeProfile

func (dm *DataManager) RemoveAttributeProfile(tenant, id string, withIndex bool) (err error)

func (*DataManager) RemoveChargerProfile

func (dm *DataManager) RemoveChargerProfile(tenant, id string, withIndex bool) (err error)

func (*DataManager) RemoveDestination

func (dm *DataManager) RemoveDestination(destID string, transactionID string) (err error)

func (*DataManager) RemoveDispatcherHost

func (dm *DataManager) RemoveDispatcherHost(tenant, id string) (err error)

func (*DataManager) RemoveDispatcherProfile

func (dm *DataManager) RemoveDispatcherProfile(tenant, id string, withIndex bool) (err error)

func (*DataManager) RemoveFilter

func (dm *DataManager) RemoveFilter(tenant, id string, withIndex bool) (err error)

func (*DataManager) RemoveIPAllocations added in v0.11.0

func (dm *DataManager) RemoveIPAllocations(tenant, id string) (err error)

func (*DataManager) RemoveIPProfile added in v0.11.0

func (dm *DataManager) RemoveIPProfile(tenant, id string, withIndex bool) (err error)

func (*DataManager) RemoveIndexes added in v0.11.0

func (dm *DataManager) RemoveIndexes(idxItmType, tntCtx string, idxKeys ...string) error

func (*DataManager) RemoveRanking added in v0.11.0

func (dm *DataManager) RemoveRanking(tenant, id string) (err error)

RemoveRanking removes the stored Ranking

func (*DataManager) RemoveRankingProfile added in v0.11.0

func (dm *DataManager) RemoveRankingProfile(tenant, id string) (err error)

func (*DataManager) RemoveRatingPlan

func (dm *DataManager) RemoveRatingPlan(key string, transactionID string) (err error)

func (*DataManager) RemoveRatingProfile

func (dm *DataManager) RemoveRatingProfile(key string) (err error)

func (*DataManager) RemoveResource

func (dm *DataManager) RemoveResource(tenant, id string) (err error)

func (*DataManager) RemoveResourceProfile

func (dm *DataManager) RemoveResourceProfile(tenant, id string, withIndex bool) (err error)

func (*DataManager) RemoveRouteProfile added in v0.11.0

func (dm *DataManager) RemoveRouteProfile(tenant, id string, withIndex bool) (err error)

func (*DataManager) RemoveSessionsBackup added in v0.11.0

func (dm *DataManager) RemoveSessionsBackup(nodeID, tenant, cgrid string) (err error)

RemoveSessionsBackup remove one or all sessions from dataDB backup

func (*DataManager) RemoveSharedGroup

func (dm *DataManager) RemoveSharedGroup(id, transactionID string) (err error)

func (*DataManager) RemoveStatQueue

func (dm *DataManager) RemoveStatQueue(tenant, id string) (err error)

RemoveStatQueue removes the StoredStatQueue

func (*DataManager) RemoveStatQueueProfile

func (dm *DataManager) RemoveStatQueueProfile(tenant, id string, withIndex bool) (err error)

func (*DataManager) RemoveThreshold

func (dm *DataManager) RemoveThreshold(tenant, id string) (err error)

func (*DataManager) RemoveThresholdProfile

func (dm *DataManager) RemoveThresholdProfile(tenant, id string, withIndex bool) (err error)

func (*DataManager) RemoveTiming

func (dm *DataManager) RemoveTiming(id, transactionID string) (err error)

func (*DataManager) RemoveTrend added in v0.11.0

func (dm *DataManager) RemoveTrend(tenant, id string) (err error)

RemoveTrend removes the stored Trend

func (*DataManager) RemoveTrendProfile added in v0.11.0

func (dm *DataManager) RemoveTrendProfile(tenant, id string) (err error)

func (*DataManager) SetAccount

func (dm *DataManager) SetAccount(acc *Account) error

func (*DataManager) SetAccountActionPlans

func (dm *DataManager) SetAccountActionPlans(acntID string, aPlIDs []string, overwrite bool) (err error)

func (*DataManager) SetActionPlan

func (dm *DataManager) SetActionPlan(key string, ats *ActionPlan,
	overwrite bool, transactionID string) (err error)

func (*DataManager) SetActionTriggers

func (dm *DataManager) SetActionTriggers(key string, attr ActionTriggers) (err error)

func (*DataManager) SetActions

func (dm *DataManager) SetActions(key string, as Actions) (err error)

func (*DataManager) SetAttributeProfile

func (dm *DataManager) SetAttributeProfile(ap *AttributeProfile, withIndex bool) (err error)

func (*DataManager) SetBackupSessions added in v0.11.0

func (dm *DataManager) SetBackupSessions(nodeID, tenant string,
	storedSessions []*StoredSession) (err error)

SetBackupSessions stores the active sessions in dataDB

func (*DataManager) SetChargerProfile

func (dm *DataManager) SetChargerProfile(cpp *ChargerProfile, withIndex bool) (err error)

func (*DataManager) SetDestination

func (dm *DataManager) SetDestination(dest *Destination, transactionID string) (err error)

func (*DataManager) SetDispatcherHost

func (dm *DataManager) SetDispatcherHost(dpp *DispatcherHost) (err error)

func (*DataManager) SetDispatcherProfile

func (dm *DataManager) SetDispatcherProfile(dpp *DispatcherProfile, withIndex bool) (err error)

func (*DataManager) SetFilter

func (dm *DataManager) SetFilter(fltr *Filter, withIndex bool) (err error)

func (*DataManager) SetIPAllocations added in v0.11.0

func (dm *DataManager) SetIPAllocations(ip *IPAllocations) (err error)

func (*DataManager) SetIPProfile added in v0.11.0

func (dm *DataManager) SetIPProfile(ipp *IPProfile, withIndex bool) (err error)

func (*DataManager) SetIndexes added in v0.11.0

func (dm *DataManager) SetIndexes(idxItmType, tntCtx string,
	indexes map[string]utils.StringSet, commit bool, transactionID string) error

func (*DataManager) SetLoadIDs

func (dm *DataManager) SetLoadIDs(loadIDs map[string]int64) error

SetLoadIDs sets the loadIDs in the DB

func (*DataManager) SetRanking added in v0.11.0

func (dm *DataManager) SetRanking(rn *Ranking) (err error)

SetRanking stores Ranking in dataDB

func (*DataManager) SetRankingProfile added in v0.11.0

func (dm *DataManager) SetRankingProfile(rnp *RankingProfile) (err error)

func (*DataManager) SetRatingPlan

func (dm *DataManager) SetRatingPlan(rp *RatingPlan) (err error)

func (*DataManager) SetRatingProfile

func (dm *DataManager) SetRatingProfile(rpf *RatingProfile) (err error)

func (*DataManager) SetResource

func (dm *DataManager) SetResource(rs *Resource) (err error)

func (*DataManager) SetResourceProfile

func (dm *DataManager) SetResourceProfile(rp *ResourceProfile, withIndex bool) (err error)

func (*DataManager) SetReverseDestination

func (dm *DataManager) SetReverseDestination(destID string, prefixes []string, transactionID string) (err error)

func (*DataManager) SetRouteProfile added in v0.11.0

func (dm *DataManager) SetRouteProfile(rpp *RouteProfile, withIndex bool) (err error)

func (*DataManager) SetSharedGroup

func (dm *DataManager) SetSharedGroup(sg *SharedGroup) (err error)

func (*DataManager) SetStatQueue

func (dm *DataManager) SetStatQueue(sq *StatQueue) (err error)

SetStatQueue converts to StoredStatQueue and stores the result in dataDB

func (*DataManager) SetStatQueueProfile

func (dm *DataManager) SetStatQueueProfile(sqp *StatQueueProfile, withIndex bool) (err error)

func (*DataManager) SetThreshold

func (dm *DataManager) SetThreshold(th *Threshold) (err error)

func (*DataManager) SetThresholdProfile

func (dm *DataManager) SetThresholdProfile(th *ThresholdProfile, withIndex bool) (err error)

func (*DataManager) SetTiming

func (dm *DataManager) SetTiming(t *utils.TPTiming) (err error)

func (*DataManager) SetTrend added in v0.11.0

func (dm *DataManager) SetTrend(tr *Trend) (err error)

SetTrend stores Trend in dataDB

func (*DataManager) SetTrendProfile added in v0.11.0

func (dm *DataManager) SetTrendProfile(trp *TrendProfile) (err error)

func (*DataManager) UpdateReverseDestination

func (dm *DataManager) UpdateReverseDestination(oldDest, newDest *Destination,
	transactionID string) (err error)

type DataSpan

type DataSpan struct {
	DataStart, DataEnd float64
	Cost               float64

	RateInterval *RateInterval
	DataIndex    float64 // the data transfer so far till DataEnd
	Increments   []*DataIncrement
	MatchedSubject, MatchedPrefix,
	MatchedDestId, RatingPlanId string
	// contains filtered or unexported fields
}

type DebitInfo

type DebitInfo struct {
	Unit      *UnitInfo
	Monetary  *MonetaryInfo
	AccountID string // used when debited from shared balance
}

Holds information about the balance that made a specific payment

func (*DebitInfo) Clone

func (di *DebitInfo) Clone() *DebitInfo

func (*DebitInfo) Equal

func (di *DebitInfo) Equal(other *DebitInfo) bool

type Destination

type Destination struct {
	Id       string
	Prefixes []string
}

Structure that gathers multiple destination prefixes under a common id.

func NewDestinationFromTPDestination

func NewDestinationFromTPDestination(tpDst *utils.TPDestination) *Destination

func (*Destination) AddPrefix

func (d *Destination) AddPrefix(pfx string)

func (*Destination) CacheClone added in v0.11.0

func (d *Destination) CacheClone() any

CacheClone returns a clone of Destination used by ltcache CacheCloner

func (*Destination) Clone added in v0.11.0

func (d *Destination) Clone() *Destination

Clone returns a clone of Destination

func (*Destination) String

func (d *Destination) String() (result string)

type DestinationMdl added in v0.11.0

type DestinationMdl struct {
	Id        int64
	Tpid      string
	Tag       string `index:"0" re:".*"`
	Prefix    string `index:"1" re:".*"`
	CreatedAt time.Time
}

func (DestinationMdl) TableName added in v0.11.0

func (DestinationMdl) TableName() string

type DestinationMdls added in v0.11.0

type DestinationMdls []DestinationMdl

func APItoModelDestination

func APItoModelDestination(d *utils.TPDestination) (result DestinationMdls)

func (DestinationMdls) AsMapDestinations added in v0.11.0

func (tps DestinationMdls) AsMapDestinations() (map[string]*Destination, error)

func (DestinationMdls) AsTPDestinations added in v0.11.0

func (tps DestinationMdls) AsTPDestinations() (result []*utils.TPDestination)

AsTPDestination converts DestinationMdls into *utils.TPDestination

type DestinationRateMdl added in v0.11.0

type DestinationRateMdl struct {
	Id               int64
	Tpid             string
	Tag              string  `index:"0" re:".*"`
	DestinationsTag  string  `index:"1" re:".*"`
	RatesTag         string  `index:"2" re:".*"`
	RoundingMethod   string  `index:"3" re:".*"`
	RoundingDecimals int     `index:"4" re:".*"`
	MaxCost          float64 `index:"5" re:".*"`
	MaxCostStrategy  string  `index:"6" re:".*"`
	CreatedAt        time.Time
}

func (DestinationRateMdl) TableName added in v0.11.0

func (DestinationRateMdl) TableName() string

type DestinationRateMdls added in v0.11.0

type DestinationRateMdls []DestinationRateMdl

func APItoModelDestinationRate

func APItoModelDestinationRate(d *utils.TPDestinationRate) (result DestinationRateMdls)

func APItoModelDestinationRates

func APItoModelDestinationRates(drs []*utils.TPDestinationRate) (result DestinationRateMdls)

func (DestinationRateMdls) AsMapDestinationRates added in v0.11.0

func (tps DestinationRateMdls) AsMapDestinationRates() (result map[string]*utils.TPDestinationRate)

func (DestinationRateMdls) AsTPDestinationRates added in v0.11.0

func (tps DestinationRateMdls) AsTPDestinationRates() (result []*utils.TPDestinationRate)

type DestinationWithAPIOpts added in v0.11.0

type DestinationWithAPIOpts struct {
	*Destination
	Tenant  string
	APIOpts map[string]any
}

type DispatcherHost

type DispatcherHost struct {
	Tenant string
	*config.RemoteHost
	// contains filtered or unexported fields
}

DispatcherHost represents one virtual host used by dispatcher

func APItoDispatcherHost

func APItoDispatcherHost(tpDPH *utils.TPDispatcherHost) (dpp *DispatcherHost)

func (*DispatcherHost) Call

func (dH *DispatcherHost) Call(ctx *context.Context, serviceMethod string, args any, reply any) (err error)

Call will build and cache the connection if it is not defined yet then will execute the method on conn

func (*DispatcherHost) TenantID

func (dH *DispatcherHost) TenantID() string

TenantID returns the tenant concatenated with the ID

type DispatcherHostIDs added in v0.11.0

type DispatcherHostIDs []string

func (*DispatcherHostIDs) CacheClone added in v0.11.0

func (dHPrflIDs *DispatcherHostIDs) CacheClone() any

CacheClone returns a clone of DispatcherHostIDs used by ltcache CacheCloner

func (DispatcherHostIDs) Clone added in v0.11.0

func (dHPrflIDs DispatcherHostIDs) Clone() (cln DispatcherHostIDs)

func (DispatcherHostIDs) ReorderFromIndex added in v0.11.0

func (dHPrflIDs DispatcherHostIDs) ReorderFromIndex(idx int)

ReorderFromIndex will consider idx as starting point for the reordered slice

func (DispatcherHostIDs) Shuffle added in v0.11.0

func (dHPrflIDs DispatcherHostIDs) Shuffle()

Shuffle will mix the connections in place

type DispatcherHostMdl added in v0.11.0

type DispatcherHostMdl struct {
	PK                   uint   `gorm:"primary_key"`
	Tpid                 string //
	Tenant               string `index:"0" re:".*"`
	ID                   string `index:"1" re:".*"`
	Address              string `index:"2" re:".*"`
	Transport            string `index:"3" re:".*"`
	ConnectAttempts      int    `index:"4" re:".*"`
	Reconnects           int    `index:"5" re:".*"`
	MaxReconnectInterval string `index:"6" re:".*"`
	ConnectTimeout       string `index:"7" re:".*"`
	ReplyTimeout         string `index:"8" re:".*"`
	TLS                  bool   `index:"9" re:".*"`
	ClientKey            string `index:"10" re:".*"`
	ClientCertificate    string `index:"11" re:".*"`
	CaCertificate        string `index:"12" re:".*"`
	CreatedAt            time.Time
}

func APItoModelTPDispatcherHost

func APItoModelTPDispatcherHost(tpDPH *utils.TPDispatcherHost) (mdls *DispatcherHostMdl)

func (DispatcherHostMdl) TableName added in v0.11.0

func (DispatcherHostMdl) TableName() string

type DispatcherHostMdls added in v0.11.0

type DispatcherHostMdls []*DispatcherHostMdl

TPHosts

func (DispatcherHostMdls) AsTPDispatcherHosts added in v0.11.0

func (tps DispatcherHostMdls) AsTPDispatcherHosts() (result []*utils.TPDispatcherHost, err error)

func (DispatcherHostMdls) CSVHeader added in v0.11.0

func (tps DispatcherHostMdls) CSVHeader() (result []string)

CSVHeader return the header for csv fields as a slice of string

type DispatcherHostProfile

type DispatcherHostProfile struct {
	ID        string
	FilterIDs []string
	Weight    float64        // applied in case of multiple connections need to be ordered
	Params    map[string]any // additional parameters stored for a session
	Blocker   bool           // no connection after this one
}

func (*DispatcherHostProfile) Clone

func (dC *DispatcherHostProfile) Clone() (cln *DispatcherHostProfile)

type DispatcherHostProfiles

type DispatcherHostProfiles []*DispatcherHostProfile

func (DispatcherHostProfiles) Clone

func (dHPrfls DispatcherHostProfiles) Clone() (cln DispatcherHostProfiles)

func (DispatcherHostProfiles) HostIDs

func (dHPrfls DispatcherHostProfiles) HostIDs() (hostIDs []string)

func (DispatcherHostProfiles) ReorderFromIndex

func (dHPrfls DispatcherHostProfiles) ReorderFromIndex(idx int)

ReorderFromIndex will consider idx as starting point for the reordered slice

func (DispatcherHostProfiles) Shuffle

func (dHPrfls DispatcherHostProfiles) Shuffle()

Shuffle will mix the connections in place

func (DispatcherHostProfiles) Sort

func (dHPrfls DispatcherHostProfiles) Sort()

Sort is part of sort interface, sort based on Weight

type DispatcherHostWithAPIOpts added in v0.11.0

type DispatcherHostWithAPIOpts struct {
	*DispatcherHost
	APIOpts map[string]any
}

DispatcherHostWithOpts is used in replicatorV1 for dispatcher

type DispatcherProfile

type DispatcherProfile struct {
	Tenant             string
	ID                 string
	Subsystems         []string
	FilterIDs          []string
	ActivationInterval *utils.ActivationInterval // activation interval
	Strategy           string
	StrategyParams     map[string]any         // ie for distribution, set here the pool weights
	Weight             float64                // used for profile sorting on match
	Hosts              DispatcherHostProfiles // dispatch to these connections
}

DispatcherProfile is the config for one Dispatcher

func APItoDispatcherProfile

func APItoDispatcherProfile(tpDPP *utils.TPDispatcherProfile, timezone string) (dpp *DispatcherProfile, err error)

func (*DispatcherProfile) CacheClone added in v0.11.0

func (dp *DispatcherProfile) CacheClone() any

CacheClone returns a clone of DispatcherProfile used by ltcache CacheCloner

func (*DispatcherProfile) Clone added in v0.11.0

func (dp *DispatcherProfile) Clone() *DispatcherProfile

Clone method for DispatcherProfile

func (*DispatcherProfile) TenantID

func (dP *DispatcherProfile) TenantID() string

type DispatcherProfileMdl added in v0.11.0

type DispatcherProfileMdl struct {
	PK                 uint    `gorm:"primary_key"`
	Tpid               string  //
	Tenant             string  `index:"0" re:".*"`
	ID                 string  `index:"1" re:".*"`
	Subsystems         string  `index:"2" re:".*"`
	FilterIDs          string  `index:"3" re:".*"`
	ActivationInterval string  `index:"4" re:".*"`
	Strategy           string  `index:"5" re:".*"`
	StrategyParameters string  `index:"6" re:".*"`
	ConnID             string  `index:"7" re:".*"`
	ConnFilterIDs      string  `index:"8" re:".*"`
	ConnWeight         float64 `index:"9" re:".*"`
	ConnBlocker        bool    `index:"10" re:".*"`
	ConnParameters     string  `index:"11" re:".*"`
	Weight             float64 `index:"12" re:".*"`
	CreatedAt          time.Time
}

func (DispatcherProfileMdl) TableName added in v0.11.0

func (DispatcherProfileMdl) TableName() string

type DispatcherProfileMdls added in v0.11.0

type DispatcherProfileMdls []*DispatcherProfileMdl

func APItoModelTPDispatcherProfile

func APItoModelTPDispatcherProfile(tpDPP *utils.TPDispatcherProfile) (mdls DispatcherProfileMdls)

func (DispatcherProfileMdls) AsTPDispatcherProfiles added in v0.11.0

func (tps DispatcherProfileMdls) AsTPDispatcherProfiles() (result []*utils.TPDispatcherProfile)

func (DispatcherProfileMdls) CSVHeader added in v0.11.0

func (tps DispatcherProfileMdls) CSVHeader() (result []string)

CSVHeader return the header for csv fields as a slice of string

type DispatcherProfileWithAPIOpts added in v0.11.0

type DispatcherProfileWithAPIOpts struct {
	*DispatcherProfile
	APIOpts map[string]any
}

DispatcherProfileWithAPIOpts is used in replicatorV1 for dispatcher

type DispatcherProfiles

type DispatcherProfiles []*DispatcherProfile

DispatcherProfiles is a sortable list of Dispatcher profiles

func (DispatcherProfiles) Sort

func (dps DispatcherProfiles) Sort()

Sort is part of sort interface, sort based on Weight

type DurationWithCompress

type DurationWithCompress struct {
	Duration       time.Duration
	CompressFactor int
}

ACDHelper structure

func (*DurationWithCompress) Clone added in v0.11.0

Clone creates a deep copy of DurationWithCompress

type EventCost

type EventCost struct {
	CGRID          string
	RunID          string
	StartTime      time.Time
	Usage          *time.Duration
	Cost           *float64 // pointer so we can nil it when dirty
	Charges        []*ChargingInterval
	AccountSummary *AccountSummary // Account summary at the end of the event calculation
	Rating         Rating
	Accounting     Accounting
	RatingFilters  RatingFilters
	Rates          ChargedRates
	Timings        ChargedTimings
	// contains filtered or unexported fields
}

EventCost stores cost for an Event

func ConvertToEventCost added in v0.11.0

func ConvertToEventCost(cd any) (*EventCost, error)

func IfaceAsEventCost

func IfaceAsEventCost(itm any) (ec *EventCost, err error)

IfaceAsEventCost converts an interface to EventCost

func NewBareEventCost

func NewBareEventCost() *EventCost

NewBareEventCost will intialize the EventCost with minimum information

func NewEventCostFromCallCost

func NewEventCostFromCallCost(cc *CallCost, cgrID, runID string) (ec *EventCost)

NewEventCostFromCallCost will initilaize the EventCost from a CallCost

func NewFreeEventCost added in v0.11.0

func NewFreeEventCost(cgrID, runID, account string, tStart time.Time, usage time.Duration) *EventCost

NewFreeEventCost returns an EventCost of given duration that it's free

func (*EventCost) AsCallCost

func (ec *EventCost) AsCallCost(tor string) *CallCost

AsCallCost converts an EventCost into a CallCost

func (*EventCost) AsRefundIncrements

func (ec *EventCost) AsRefundIncrements(tor string) (cd *CallDescriptor)

AsRefundIncrements converts an EventCost into a CallDescriptor

func (*EventCost) Clone

func (ec *EventCost) Clone() (cln *EventCost)

Clone will create a clone of the object

func (*EventCost) Compute

func (ec *EventCost) Compute()

Compute aggregates all the compute methods on EventCost

func (*EventCost) ComputeEventCostUsageIndexes

func (ec *EventCost) ComputeEventCostUsageIndexes()

ComputeEventCostUsageIndexes will iterate through Chargers and populate their ecUsageIdx

func (*EventCost) FieldAsInterface

func (ec *EventCost) FieldAsInterface(fldPath []string) (val any, err error)

FieldAsInterface func to implement DataProvider

func (*EventCost) FieldAsString

func (ec *EventCost) FieldAsString(fldPath []string) (string, error)

FieldAsString to implement Dataprovider

func (*EventCost) GetCost

func (ec *EventCost) GetCost() float64

GetCost iterates through Charges, computing EventCost.Cost

func (*EventCost) GetKeys added in v0.11.0

func (ec *EventCost) GetKeys(nested bool, nesteedLimit int, prefix string) []string

GetKeys is implemented to meet the DataStorage interface requirements for EventCost type variables. It has no functionality.

func (*EventCost) GetUsage

func (ec *EventCost) GetUsage() time.Duration

GetUsage iterates through Charges, computing EventCost.Usage

func (*EventCost) Merge

func (ec *EventCost) Merge(ecs ...*EventCost)

Merge will merge a list of EventCosts into this one

func (*EventCost) Remove added in v0.11.0

func (ec *EventCost) Remove(fldPath []string) error

Remove is implemented to meet the DataStorage interface requirements for EventCost type variables. It has no functionality.

func (*EventCost) RemoveStaleReferences

func (ec *EventCost) RemoveStaleReferences()

RemoveStaleReferences iterates through cached data and makes sure it is still referenced from Charging

func (*EventCost) ResetCounters

func (ec *EventCost) ResetCounters()

ResetCounters will reset all the computed cached values

func (*EventCost) Set added in v0.11.0

func (ec *EventCost) Set(fldPath []string, val any) error

Set is implemented to meet the DataStorage interface requirements for EventCost type variables. It has no functionality.

func (*EventCost) String

func (ec *EventCost) String() string

String to implement Dataprovider

func (*EventCost) SyncKeys

func (ec *EventCost) SyncKeys(refEC *EventCost)

SyncKeys will sync the keys present into ec with the ones in refEC

func (*EventCost) Trim

func (ec *EventCost) Trim(atUsage time.Duration) (srplusEC *EventCost, err error)

Trim will cut the EventCost at specific duration returns the srplusEC as separate EventCost

type ExportRequest added in v0.11.0

type ExportRequest struct {
	ExpData map[string]*utils.OrderedNavigableMap // *exp:OrderNavMp *trl:OrderNavMp *cdr:OrderNavMp
	// contains filtered or unexported fields
}

ExportRequest represents data related to one request towards agent implements utils.DataProvider so we can pass it to filters

func NewExportRequest added in v0.11.0

func NewExportRequest(inData map[string]utils.DataStorage,
	tnt string,
	filterS *FilterS, oNM map[string]*utils.OrderedNavigableMap) (eeR *ExportRequest)

NewExportRequest returns a new EventRequest

func (*ExportRequest) Append added in v0.11.0

func (eeR *ExportRequest) Append(fullPath *utils.FullPath, val *utils.DataLeaf) (err error)

Set sets the value at the given path this used with full path and the processed path to not calculate them for every set

func (*ExportRequest) Compose added in v0.11.0

func (eeR *ExportRequest) Compose(fullPath *utils.FullPath, val *utils.DataLeaf) (err error)

Set sets the value at the given path this used with full path and the processed path to not calculate them for every set

func (*ExportRequest) FieldAsInterface added in v0.11.0

func (eeR *ExportRequest) FieldAsInterface(fldPath []string) (val any, err error)

FieldAsInterface implements utils.DataProvider

func (*ExportRequest) FieldAsString added in v0.11.0

func (eeR *ExportRequest) FieldAsString(fldPath []string) (val string, err error)

FieldAsString implements utils.DataProvider

func (*ExportRequest) ParseField added in v0.11.0

func (eeR *ExportRequest) ParseField(
	cfgFld *config.FCTemplate) (out any, err error)

ParseField outputs the value based on the template item

func (*ExportRequest) SetAsSlice added in v0.11.0

func (eeR *ExportRequest) SetAsSlice(fullPath *utils.FullPath, val *utils.DataLeaf) (err error)

Set implements utils.NMInterface

func (*ExportRequest) SetFields added in v0.11.0

func (eeR *ExportRequest) SetFields(tplFlds []*config.FCTemplate) (err error)

SetFields will populate fields of AgentRequest out of templates

func (*ExportRequest) String added in v0.11.0

func (eeR *ExportRequest) String() string

String implements utils.DataProvider

type ExternalAttribute

type ExternalAttribute struct {
	FilterIDs []string
	Path      string
	Type      string
	Value     string
}

ExternalAttribute the attribute for external profile

type ExternalCDR

type ExternalCDR struct {
	CGRID       string
	RunID       string
	OrderID     int64
	OriginHost  string
	Source      string
	OriginID    string
	ToR         string
	RequestType string
	Tenant      string
	Category    string
	Account     string
	Subject     string
	Destination string
	SetupTime   string
	AnswerTime  string
	Usage       string
	ExtraFields map[string]string
	CostSource  string
	Cost        float64
	CostDetails string
	ExtraInfo   string
	PreRated    bool // Mark the CDR as rated so we do not process it during mediation
}

type ExternalCDRWithAPIOpts added in v0.11.0

type ExternalCDRWithAPIOpts struct {
	*ExternalCDR
	APIOpts map[string]any
}

type FSCdr

type FSCdr struct {
	// contains filtered or unexported fields
}

func NewFSCdr

func NewFSCdr(body io.Reader, cgrCfg *config.CGRConfig) (*FSCdr, error)

func (FSCdr) AsCDR

func (fsCdr FSCdr) AsCDR(timezone string) (storCdr *CDR, err error)

type Filter

type Filter struct {
	Tenant             string
	ID                 string
	Rules              []*FilterRule
	ActivationInterval *utils.ActivationInterval
}

Filter structure to define a basic filter

func APItoFilter

func APItoFilter(tpTH *utils.TPFilterProfile, timezone string) (th *Filter, err error)

func NewFilterFromInline

func NewFilterFromInline(tenant, inlnRule string) (f *Filter, err error)

NewFilterFromInline parses an inline rule into a compiled Filter

func (*Filter) CacheClone added in v0.11.0

func (fltr *Filter) CacheClone() any

CacheClone returns a clone of Filter used by ltcache CacheCloner

func (*Filter) Clone added in v0.11.0

func (fltr *Filter) Clone() *Filter

Clone method for Filter

func (*Filter) Compile

func (fltr *Filter) Compile() (err error)

Compile will compile the underlaying request filters where necessary (ie. regexp rules)

func (*Filter) TenantID

func (fltr *Filter) TenantID() string

TenantID returns the tenant wit the ID

type FilterIHReply added in v0.10.3

type FilterIHReply struct {
	MissingObjects []string            // list of object that are referenced in indexes but are not found in the dataDB
	MissingIndexes map[string][]string // list of missing indexes for each object (the map has the key as the objectID and a list of indexes)
	BrokenIndexes  map[string][]string // list of broken indexes for each object (the map has the key as the index and a list of objects)
	MissingFilters map[string][]string // list of broken references (the map has the key as the filterID and a list of  objectIDs)
}

func GetFltrIdxHealth added in v0.10.3

func GetFltrIdxHealth(dm *DataManager, fltrCache, fltrIdxCache, objCache *ltcache.Cache, indxType string) (rply *FilterIHReply, err error)

GetFltrIdxHealth returns the missing indexes for all objects

type FilterMdl added in v0.11.0

type FilterMdl struct {
	PK                 uint `gorm:"primary_key"`
	Tpid               string
	Tenant             string `index:"0" re:".*"`
	ID                 string `index:"1" re:".*"`
	Type               string `index:"2" re:".*"`
	Element            string `index:"3" re:".*"`
	Values             string `index:"4" re:".*"`
	ActivationInterval string `index:"5" re:".*"`
	CreatedAt          time.Time
}

func (FilterMdl) TableName added in v0.11.0

func (FilterMdl) TableName() string

type FilterMdls added in v0.11.0

type FilterMdls []*FilterMdl

func APItoModelTPFilter

func APItoModelTPFilter(th *utils.TPFilterProfile) (mdls FilterMdls)

func (FilterMdls) AsTPFilter added in v0.11.0

func (tps FilterMdls) AsTPFilter() (result []*utils.TPFilterProfile)

func (FilterMdls) CSVHeader added in v0.11.0

func (tps FilterMdls) CSVHeader() (result []string)

CSVHeader return the header for csv fields as a slice of string

type FilterRule

type FilterRule struct {
	Type    string   // Filter type (*string, *timing, *rsr_filters, *stats, *lt, *lte, *gt, *gte)
	Element string   // Name of the field providing us the Values to check (used in case of some )
	Values  []string // Filter definition
	// contains filtered or unexported fields
}

FilterRule filters requests coming into various places Pass rule: default negative, one matching rule should pass the filter

func NewFilterRule

func NewFilterRule(rfType, fieldName string, vals []string) (*FilterRule, error)

NewFilterRule returns a new filter

func (*FilterRule) Clone added in v0.11.0

func (fltr *FilterRule) Clone() *FilterRule

Clone method for FilterRule

func (*FilterRule) CompileValues

func (fltr *FilterRule) CompileValues() (err error)

CompileValues compiles RSR fields

func (*FilterRule) ElementItems added in v0.11.0

func (fltr *FilterRule) ElementItems() []string

Will return all items the element, e.g. "~*req", "cost_details", "Charges[0]". "RatingID"

func (*FilterRule) FilterToSQLQuery added in v0.11.0

func (fltr *FilterRule) FilterToSQLQuery() (conditions []string)

Creates mysql conditions used in WHERE statement out of filters

func (*FilterRule) Pass

func (fltr *FilterRule) Pass(dDP utils.DataProvider) (result bool, err error)

Pass is the method which should be used from outside.

type FilterS

type FilterS struct {
	// contains filtered or unexported fields
}

FilterS is a service used to take decisions in case of filters uses lazy connections where necessary to avoid deadlocks on service startup

func NewFilterS

func NewFilterS(cfg *config.CGRConfig, connMgr *ConnManager, dm *DataManager) (fS *FilterS)

NewFilterS initializtes the filter service

func (*FilterS) LazyPass added in v0.11.0

func (fS *FilterS) LazyPass(tenant string, filterIDs []string,
	ev utils.DataProvider, pathPrfxs []string) (pass bool, lazyCheckRules []*FilterRule, err error)

LazyPass is almost the same as Pass except that it verify if the Element of the Values from FilterRules has as prefix one of the pathPrfxs

func (*FilterS) Pass

func (fS *FilterS) Pass(tenant string, filterIDs []string,
	ev utils.DataProvider) (pass bool, err error)

Pass will check all filters within filterIDs and require them passing for dataProvider there should be at least one filter passing, ie: if filters are not active event will fail to pass receives the event as DataProvider so we can accept undecoded data (ie: HttpRequest)

type FilterWithAPIOpts added in v0.11.0

type FilterWithAPIOpts struct {
	*Filter
	APIOpts map[string]any
}

FilterWithOpts the arguments for the replication

type GOBMarshaler

type GOBMarshaler struct{}

func (*GOBMarshaler) Marshal

func (gm *GOBMarshaler) Marshal(v any) (data []byte, err error)

func (*GOBMarshaler) Unmarshal

func (gm *GOBMarshaler) Unmarshal(data []byte, v any) error

type HighestBalancesSorter

type HighestBalancesSorter []*Balance

func (HighestBalancesSorter) Len

func (hbcs HighestBalancesSorter) Len() int

func (HighestBalancesSorter) Less

func (hbcs HighestBalancesSorter) Less(i, j int) bool

func (HighestBalancesSorter) Swap

func (hbcs HighestBalancesSorter) Swap(i, j int)

type HightCostSorter

type HightCostSorter struct {
	// contains filtered or unexported fields
}

HightCostSorter sorts routes based on their cost

func NewHighestCostSorter

func NewHighestCostSorter(rS *RouteService) *HightCostSorter

func (*HightCostSorter) SortRoutes added in v0.11.0

func (hcs *HightCostSorter) SortRoutes(prflID string, routes map[string]*Route,
	ev *utils.CGREvent, extraOpts *optsGetRoutes) (sortedRoutes *SortedRoutes, err error)

type IPAllocations added in v0.11.0

type IPAllocations struct {
	Tenant      string
	ID          string
	Allocations map[string]*PoolAllocation // map[allocID]*PoolAllocation
	TTLIndex    []string                   // allocIDs ordered by allocation time for TTL expiry
	// contains filtered or unexported fields
}

IPAllocations represents IP allocations with usage tracking and TTL management.

func (*IPAllocations) CacheClone added in v0.11.0

func (a *IPAllocations) CacheClone() any

CacheClone returns a clone of IPAllocations object used by ltcache CacheCloner.

func (*IPAllocations) Clone added in v0.11.0

func (a *IPAllocations) Clone() *IPAllocations

Clone creates a deep clone of the IPAllocations object (lockID excluded).

func (*IPAllocations) TenantID added in v0.11.0

func (a *IPAllocations) TenantID() string

TenantID returns the unique ID in a multi-tenant environment

type IPAllocationsWithAPIOpts added in v0.11.0

type IPAllocationsWithAPIOpts struct {
	*IPAllocations
	APIOpts map[string]any
}

IPAllocationsWithAPIOpts wraps IPAllocations with APIOpts.

type IPMdl added in v0.11.0

type IPMdl struct {
	PK                 uint `gorm:"primary_key"`
	Tpid               string
	Tenant             string  `index:"0" re:".*"`
	ID                 string  `index:"1" re:".*"`
	FilterIDs          string  `index:"2" re:".*"`
	ActivationInterval string  `index:"3" re:".*"`
	TTL                string  `index:"4" re:".*"`
	Stored             bool    `index:"5" re:".*"`
	Weight             float64 `index:"6" re:".*"`
	PoolID             string  `index:"7" re:".*"`
	PoolFilterIDs      string  `index:"8" re:".*"`
	PoolType           string  `index:"9" re:".*"`
	PoolRange          string  `index:"10" re:".*"`
	PoolStrategy       string  `index:"11" re:".*"`
	PoolMessage        string  `index:"12" re:".*"`
	PoolWeight         float64 `index:"13" re:".*"`
	PoolBlocker        bool    `index:"14" re:".*"`
	CreatedAt          time.Time
}

func (IPMdl) TableName added in v0.11.0

func (IPMdl) TableName() string

type IPMdls added in v0.11.0

type IPMdls []*IPMdl

func APItoModelIP added in v0.11.0

func APItoModelIP(tp *utils.TPIPProfile) IPMdls

func (IPMdls) AsTPIPs added in v0.11.0

func (tps IPMdls) AsTPIPs() []*utils.TPIPProfile

func (IPMdls) CSVHeader added in v0.11.0

func (tps IPMdls) CSVHeader() []string

CSVHeader return the header for csv fields as a slice of string

type IPPool added in v0.11.0

type IPPool struct {
	ID        string
	FilterIDs []string
	Type      string
	Range     string
	Strategy  string
	Message   string
	Weight    float64
	Blocker   bool
}

IPPool defines a pool of IP addresses within an IPProfile.

func (*IPPool) Clone added in v0.11.0

func (p *IPPool) Clone() *IPPool

Clone creates a deep copy of Pool for thread-safe use.

type IPProfile added in v0.11.0

type IPProfile struct {
	Tenant             string
	ID                 string
	FilterIDs          []string
	ActivationInterval *utils.ActivationInterval
	Weight             float64
	TTL                time.Duration
	Stored             bool
	Pools              []*IPPool
	// contains filtered or unexported fields
}

IPProfile defines the configuration of an IPAllocations object.

func APItoIP added in v0.11.0

func APItoIP(tp *utils.TPIPProfile, timezone string) (*IPProfile, error)

func (*IPProfile) CacheClone added in v0.11.0

func (p *IPProfile) CacheClone() any

CacheClone returns a clone of IPProfile used by ltcache CacheCloner

func (*IPProfile) Clone added in v0.11.0

func (p *IPProfile) Clone() *IPProfile

Clone creates a deep copy of IPProfile for thread-safe use.

func (*IPProfile) TenantID added in v0.11.0

func (p *IPProfile) TenantID() string

TenantID returns the concatenated tenant and ID.

type IPProfileWithAPIOpts added in v0.11.0

type IPProfileWithAPIOpts struct {
	*IPProfile
	APIOpts map[string]any
}

IPProfileWithAPIOpts wraps IPProfile with APIOpts.

type IPService added in v0.11.0

type IPService struct {
	// contains filtered or unexported fields
}

IPService is the service handling IP allocations

func NewIPService added in v0.11.0

func NewIPService(dm *DataManager, cfg *config.CGRConfig, fltrs *FilterS,
	cm *ConnManager) *IPService

NewIPService returns a new IPService.

func (*IPService) Reload added in v0.11.0

func (s *IPService) Reload()

Reload restarts the backup loop. No-op after Shutdown.

func (*IPService) Shutdown added in v0.11.0

func (s *IPService) Shutdown()

Shutdown is called to shutdown the service

func (*IPService) StartLoop added in v0.11.0

func (s *IPService) StartLoop()

StartLoop starts the goroutine with the backup loop

func (*IPService) V1AllocateIP added in v0.11.0

func (s *IPService) V1AllocateIP(ctx *context.Context, args *utils.CGREvent, reply *AllocatedIP) (err error)

V1AllocateIP allocates an IP address for the given event.

func (*IPService) V1AuthorizeIP added in v0.11.0

func (s *IPService) V1AuthorizeIP(ctx *context.Context, args *utils.CGREvent, reply *AllocatedIP) (err error)

V1AuthorizeIP checks if it's able to allocate an IP address for the given event.

func (*IPService) V1ClearIPAllocations added in v0.11.0

func (s *IPService) V1ClearIPAllocations(ctx *context.Context, args *ClearIPAllocationsArgs, reply *string) error

V1ClearIPAllocations clears IP allocations from an IPAllocations object. If args.AllocationIDs is empty or nil, all allocations will be cleared.

func (*IPService) V1GetIPAllocationForEvent added in v0.11.0

func (s *IPService) V1GetIPAllocationForEvent(ctx *context.Context, args *utils.CGREvent, reply *IPAllocations) (err error)

V1GetIPAllocationForEvent returns the IPAllocations object matching the event.

func (*IPService) V1GetIPAllocations added in v0.11.0

func (s *IPService) V1GetIPAllocations(ctx *context.Context, arg *utils.TenantIDWithAPIOpts, reply *IPAllocations) error

V1GetIPAllocations returns all IP allocations for a tenantID.

func (*IPService) V1ReleaseIP added in v0.11.0

func (s *IPService) V1ReleaseIP(ctx *context.Context, args *utils.CGREvent, reply *string) (err error)

V1ReleaseIP releases an allocated IP address for the given event.

type Increment

type Increment struct {
	Duration       time.Duration
	Cost           float64
	BalanceInfo    *DebitInfo // need more than one for units with cost
	CompressFactor int
}

func (*Increment) Clone

func (incr *Increment) Clone() *Increment

func (*Increment) Equal

func (incr *Increment) Equal(other *Increment) bool

func (*Increment) GetCompressFactor

func (incr *Increment) GetCompressFactor() int

func (*Increment) GetCost

func (incr *Increment) GetCost() float64

type Increments

type Increments []*Increment

func (Increments) Clone

func (incs Increments) Clone() (cln Increments)

func (*Increments) Compress

func (incs *Increments) Compress()

func (*Increments) Decompress

func (incs *Increments) Decompress()

func (Increments) Equal

func (incs Increments) Equal(other Increments) bool

func (Increments) GetTotalCost

func (incs Increments) GetTotalCost() float64

func (Increments) Length

func (incs Increments) Length() (length int)

func (Increments) SharingSignature

func (incs Increments) SharingSignature(other Increments) bool

Estimate whether the increments are the same ignoring the CompressFactor

type IndexHealthArgsWith2Ch added in v0.10.3

type IndexHealthArgsWith2Ch struct {
	IndexCacheLimit     int
	IndexCacheTTL       time.Duration
	IndexCacheStaticTTL bool

	ObjectCacheLimit     int
	ObjectCacheTTL       time.Duration
	ObjectCacheStaticTTL bool
}

type IndexHealthArgsWith3Ch added in v0.10.3

type IndexHealthArgsWith3Ch struct {
	IndexCacheLimit     int
	IndexCacheTTL       time.Duration
	IndexCacheStaticTTL bool

	ObjectCacheLimit     int
	ObjectCacheTTL       time.Duration
	ObjectCacheStaticTTL bool

	FilterCacheLimit     int
	FilterCacheTTL       time.Duration
	FilterCacheStaticTTL bool
}

type IntService added in v0.11.0

type IntService map[string]*birpc.Service

func (IntService) Call added in v0.11.0

func (s IntService) Call(ctx *context.Context, serviceMethod string, args, reply any) error

type InternalDB

type InternalDB struct {
	// contains filtered or unexported fields
}

InternalDB is used as a DataDB and a StorDB

func NewInternalDB

func NewInternalDB(stringIndexedFields, prefixIndexedFields []string, isDataDB bool,
	transCacheOpts *ltcache.TransCacheOpts, itmsCfg map[string]*config.ItemOpt) (iDB *InternalDB,
	err error)

NewInternalDB constructs an InternalDB

func (*InternalDB) AddLoadHistory

func (iDB *InternalDB) AddLoadHistory(*utils.LoadInstance, int, string) error

func (*InternalDB) BackupDataDB added in v0.11.0

func (iDB *InternalDB) BackupDataDB(backupFolderPath string, zip bool) (err error)

BackupDataDB will momentarely stop any dumping and rewriting until all dump folder is backed up in folder path backupFolderPath, making zip true will create a zip file in the path instead

func (*InternalDB) BackupStorDB added in v0.11.0

func (iDB *InternalDB) BackupStorDB(backupFolderPath string, zip bool) (err error)

BackupStorDB will momentarely stop any dumping and rewriting until all dump folder is backed up in folder path backupFolderPath, making zip true will create a zip file in the path instead

func (*InternalDB) Close

func (iDB *InternalDB) Close()

Close only to implement Storage interface

func (*InternalDB) DumpDataDB added in v0.11.0

func (iDB *InternalDB) DumpDataDB() (err error)

Will dump everything inside datadb to files

func (*InternalDB) DumpStorDB added in v0.11.0

func (iDB *InternalDB) DumpStorDB() (err error)

Will dump everything inside stordb to files

func (*InternalDB) Flush

func (iDB *InternalDB) Flush(string) error

Flush clears the cache

func (*InternalDB) GetAccountActionPlansDrv

func (iDB *InternalDB) GetAccountActionPlansDrv(acntID string) (apIDs []string, err error)

func (*InternalDB) GetAccountDrv

func (iDB *InternalDB) GetAccountDrv(id string) (acc *Account, err error)

func (*InternalDB) GetActionPlanDrv

func (iDB *InternalDB) GetActionPlanDrv(key string) (ats *ActionPlan, err error)

func (*InternalDB) GetActionTriggersDrv

func (iDB *InternalDB) GetActionTriggersDrv(id string) (at ActionTriggers, err error)

func (*InternalDB) GetActionsDrv

func (iDB *InternalDB) GetActionsDrv(id string) (acts Actions, err error)

func (*InternalDB) GetAllActionPlansDrv

func (iDB *InternalDB) GetAllActionPlansDrv() (ats map[string]*ActionPlan, err error)

func (*InternalDB) GetAttributeProfileDrv

func (iDB *InternalDB) GetAttributeProfileDrv(tenant, id string) (attr *AttributeProfile, err error)

func (*InternalDB) GetCDRs

func (iDB *InternalDB) GetCDRs(filter *utils.CDRsFilter, remove bool) (cdrs []*CDR, count int64, err error)

GetCDRs returns the CDRs from DB based on given filters

func (*InternalDB) GetChargerProfileDrv

func (iDB *InternalDB) GetChargerProfileDrv(tenant, id string) (ch *ChargerProfile, err error)

func (*InternalDB) GetDestinationDrv

func (iDB *InternalDB) GetDestinationDrv(key, _ string) (dest *Destination, err error)

func (*InternalDB) GetDispatcherHostDrv

func (iDB *InternalDB) GetDispatcherHostDrv(tenant, id string) (dpp *DispatcherHost, err error)

func (*InternalDB) GetDispatcherProfileDrv

func (iDB *InternalDB) GetDispatcherProfileDrv(tenant, id string) (dpp *DispatcherProfile, err error)

func (*InternalDB) GetFilterDrv

func (iDB *InternalDB) GetFilterDrv(tenant, id string) (fltr *Filter, err error)

func (*InternalDB) GetIPAllocationsDrv added in v0.11.0

func (iDB *InternalDB) GetIPAllocationsDrv(tenant, id string) (*IPAllocations, error)

func (*InternalDB) GetIPProfileDrv added in v0.11.0

func (iDB *InternalDB) GetIPProfileDrv(tenant, id string) (*IPProfile, error)

func (*InternalDB) GetIndexesDrv added in v0.11.0

func (iDB *InternalDB) GetIndexesDrv(idxItmType, tntCtx string, idxKeys ...string) (indexes map[string]utils.StringSet, err error)

func (*InternalDB) GetItemLoadIDsDrv

func (iDB *InternalDB) GetItemLoadIDsDrv(itemIDPrefix string) (loadIDs map[string]int64, err error)

func (*InternalDB) GetKeysForPrefix

func (iDB *InternalDB) GetKeysForPrefix(prefix, search string) (ids []string, err error)

GetKeysForPrefix returns the keys from cache that have the given prefix. If search is populated it will also match the string given in search parameter

func (*InternalDB) GetLoadHistory

func (iDB *InternalDB) GetLoadHistory(int, bool, string) ([]*utils.LoadInstance, error)

func (*InternalDB) GetRankingDrv added in v0.11.0

func (iDB *InternalDB) GetRankingDrv(tenant, id string) (rn *Ranking, err error)

func (*InternalDB) GetRankingProfileDrv added in v0.11.0

func (iDB *InternalDB) GetRankingProfileDrv(tenant, id string) (sg *RankingProfile, err error)

func (*InternalDB) GetRatingPlanDrv

func (iDB *InternalDB) GetRatingPlanDrv(id string) (rp *RatingPlan, err error)

func (*InternalDB) GetRatingProfileDrv

func (iDB *InternalDB) GetRatingProfileDrv(id string) (rp *RatingProfile, err error)

func (*InternalDB) GetResourceDrv

func (iDB *InternalDB) GetResourceDrv(tenant, id string) (r *Resource, err error)

func (*InternalDB) GetResourceProfileDrv

func (iDB *InternalDB) GetResourceProfileDrv(tenant, id string) (rp *ResourceProfile, err error)

func (*InternalDB) GetReverseDestinationDrv

func (iDB *InternalDB) GetReverseDestinationDrv(prefix, transactionID string) (ids []string, err error)

func (*InternalDB) GetRouteProfileDrv added in v0.11.0

func (iDB *InternalDB) GetRouteProfileDrv(tenant, id string) (spp *RouteProfile, err error)

func (*InternalDB) GetSMCosts

func (iDB *InternalDB) GetSMCosts(cgrid, runid, originHost, originIDPrfx string) (smCosts []*SMCost, err error)

func (*InternalDB) GetSessionsBackupDrv added in v0.11.0

func (iDB *InternalDB) GetSessionsBackupDrv(nodeID, tnt string) ([]*StoredSession, error)

Will restore sessions that were active from dataDB backup

func (*InternalDB) GetSharedGroupDrv

func (iDB *InternalDB) GetSharedGroupDrv(id string) (sh *SharedGroup, err error)

func (*InternalDB) GetStatQueueDrv

func (iDB *InternalDB) GetStatQueueDrv(tenant, id string) (sq *StatQueue, err error)

func (*InternalDB) GetStatQueueProfileDrv

func (iDB *InternalDB) GetStatQueueProfileDrv(tenant string, id string) (sq *StatQueueProfile, err error)

func (*InternalDB) GetStorageType

func (iDB *InternalDB) GetStorageType() string

GetStorageType returns the storage type

func (*InternalDB) GetTPAccountActions

func (iDB *InternalDB) GetTPAccountActions(filter *utils.TPAccountActions) (accounts []*utils.TPAccountActions, err error)

func (*InternalDB) GetTPActionPlans

func (iDB *InternalDB) GetTPActionPlans(tpid, id string) (aPlans []*utils.TPActionPlan, err error)

func (*InternalDB) GetTPActionTriggers

func (iDB *InternalDB) GetTPActionTriggers(tpid, id string) (aTriggers []*utils.TPActionTriggers, err error)

func (*InternalDB) GetTPActions

func (iDB *InternalDB) GetTPActions(tpid, id string) (actions []*utils.TPActions, err error)

func (*InternalDB) GetTPAttributes

func (iDB *InternalDB) GetTPAttributes(tpid, tenant, id string) (attrs []*utils.TPAttributeProfile, err error)

func (*InternalDB) GetTPChargers

func (iDB *InternalDB) GetTPChargers(tpid, tenant, id string) (cpps []*utils.TPChargerProfile, err error)

func (*InternalDB) GetTPDestinationRates

func (iDB *InternalDB) GetTPDestinationRates(tpid, id string,
	paginator *utils.Paginator) (dRates []*utils.TPDestinationRate, err error)

func (*InternalDB) GetTPDestinations

func (iDB *InternalDB) GetTPDestinations(tpid, id string) (dsts []*utils.TPDestination, err error)

func (*InternalDB) GetTPDispatcherHosts

func (iDB *InternalDB) GetTPDispatcherHosts(tpid, tenant, id string) (dpps []*utils.TPDispatcherHost, err error)

func (*InternalDB) GetTPDispatcherProfiles

func (iDB *InternalDB) GetTPDispatcherProfiles(tpid, tenant, id string) (dpps []*utils.TPDispatcherProfile, err error)

func (*InternalDB) GetTPFilters

func (iDB *InternalDB) GetTPFilters(tpid, tenant, id string) (fltrs []*utils.TPFilterProfile, err error)

func (*InternalDB) GetTPIPs added in v0.11.0

func (iDB *InternalDB) GetTPIPs(tpid, tenant, id string) ([]*utils.TPIPProfile, error)

func (*InternalDB) GetTPRankings added in v0.11.0

func (iDB *InternalDB) GetTPRankings(tpid string, tenant string, id string) (rankings []*utils.TPRankingProfile, err error)

func (*InternalDB) GetTPRates

func (iDB *InternalDB) GetTPRates(tpid, id string) (rates []*utils.TPRateRALs, err error)

func (*InternalDB) GetTPRatingPlans

func (iDB *InternalDB) GetTPRatingPlans(tpid, id string, paginator *utils.Paginator) (rPlans []*utils.TPRatingPlan, err error)

func (*InternalDB) GetTPRatingProfiles

func (iDB *InternalDB) GetTPRatingProfiles(filter *utils.TPRatingProfile) (rProfiles []*utils.TPRatingProfile, err error)

func (*InternalDB) GetTPResources

func (iDB *InternalDB) GetTPResources(tpid, tenant, id string) (resources []*utils.TPResourceProfile, err error)

func (*InternalDB) GetTPRoutes added in v0.11.0

func (iDB *InternalDB) GetTPRoutes(tpid, tenant, id string) (supps []*utils.TPRouteProfile, err error)

func (*InternalDB) GetTPSharedGroups

func (iDB *InternalDB) GetTPSharedGroups(tpid, id string) (sGroups []*utils.TPSharedGroups, err error)

func (*InternalDB) GetTPStats

func (iDB *InternalDB) GetTPStats(tpid, tenant, id string) (stats []*utils.TPStatProfile, err error)

func (*InternalDB) GetTPThresholds

func (iDB *InternalDB) GetTPThresholds(tpid, tenant, id string) (ths []*utils.TPThresholdProfile, err error)

func (*InternalDB) GetTPTimings

func (iDB *InternalDB) GetTPTimings(tpid, id string) (timings []*utils.ApierTPTiming, err error)

func (*InternalDB) GetTPTrends added in v0.11.0

func (iDB *InternalDB) GetTPTrends(tpid string, tenant string, id string) (trends []*utils.TPTrendsProfile, err error)

func (*InternalDB) GetThresholdDrv

func (iDB *InternalDB) GetThresholdDrv(tenant, id string) (th *Threshold, err error)

func (*InternalDB) GetThresholdProfileDrv

func (iDB *InternalDB) GetThresholdProfileDrv(tenant, id string) (tp *ThresholdProfile, err error)

func (*InternalDB) GetTimingDrv

func (iDB *InternalDB) GetTimingDrv(id string) (tmg *utils.TPTiming, err error)

func (*InternalDB) GetTpIds

func (iDB *InternalDB) GetTpIds(colName string) (ids []string, err error)

GetTpIds implements LoadReader interface

func (*InternalDB) GetTpTableIds

func (iDB *InternalDB) GetTpTableIds(tpid, table string, distinct utils.TPDistinctIds,
	filters map[string]string, paginator *utils.PaginatorWithSearch) (ids []string, err error)

func (*InternalDB) GetTrendDrv added in v0.11.0

func (iDB *InternalDB) GetTrendDrv(tenant, id string) (th *Trend, err error)

func (*InternalDB) GetTrendProfileDrv added in v0.11.0

func (iDB *InternalDB) GetTrendProfileDrv(tenant, id string) (sg *TrendProfile, err error)

func (*InternalDB) GetVersions

func (iDB *InternalDB) GetVersions(itm string) (vrs Versions, err error)

func (*InternalDB) HasDataDrv

func (iDB *InternalDB) HasDataDrv(category, subject, tenant string) (bool, error)

func (*InternalDB) IsDBEmpty

func (iDB *InternalDB) IsDBEmpty() (isEmpty bool, _ error)

IsDBEmpty returns true if the cache is empty

func (*InternalDB) PopTask

func (iDB *InternalDB) PopTask() (t *Task, err error)

func (*InternalDB) PushTask

func (iDB *InternalDB) PushTask(t *Task) (err error)

func (*InternalDB) RemAccountActionPlansDrv

func (iDB *InternalDB) RemAccountActionPlansDrv(acntID string) (err error)

func (*InternalDB) RemRankingProfileDrv added in v0.11.0

func (iDB *InternalDB) RemRankingProfileDrv(tenant, id string) (err error)

func (*InternalDB) RemStatQueueDrv

func (iDB *InternalDB) RemStatQueueDrv(tenant, id string) (err error)

func (*InternalDB) RemStatQueueProfileDrv

func (iDB *InternalDB) RemStatQueueProfileDrv(tenant, id string) (err error)

func (*InternalDB) RemThresholdProfileDrv

func (iDB *InternalDB) RemThresholdProfileDrv(tenant, id string) (err error)

func (*InternalDB) RemTpData

func (iDB *InternalDB) RemTpData(table, tpid string, args map[string]string) (err error)

implement LoadWriter interface

func (*InternalDB) RemTrendProfileDrv added in v0.11.0

func (iDB *InternalDB) RemTrendProfileDrv(tenant, id string) (err error)

func (*InternalDB) RemoveAccountDrv

func (iDB *InternalDB) RemoveAccountDrv(id string) (err error)

func (*InternalDB) RemoveActionPlanDrv

func (iDB *InternalDB) RemoveActionPlanDrv(key string) (err error)

func (*InternalDB) RemoveActionTriggersDrv

func (iDB *InternalDB) RemoveActionTriggersDrv(id string) (err error)

func (*InternalDB) RemoveActionsDrv

func (iDB *InternalDB) RemoveActionsDrv(id string) (err error)

func (*InternalDB) RemoveAttributeProfileDrv

func (iDB *InternalDB) RemoveAttributeProfileDrv(tenant, id string) (err error)

func (*InternalDB) RemoveChargerProfileDrv

func (iDB *InternalDB) RemoveChargerProfileDrv(tenant, id string) (err error)

func (*InternalDB) RemoveDestinationDrv

func (iDB *InternalDB) RemoveDestinationDrv(destID string, transactionID string) (err error)

func (*InternalDB) RemoveDispatcherHostDrv

func (iDB *InternalDB) RemoveDispatcherHostDrv(tenant, id string) (err error)

func (*InternalDB) RemoveDispatcherProfileDrv

func (iDB *InternalDB) RemoveDispatcherProfileDrv(tenant, id string) (err error)

func (*InternalDB) RemoveFilterDrv

func (iDB *InternalDB) RemoveFilterDrv(tenant, id string) (err error)

func (*InternalDB) RemoveIPAllocationsDrv added in v0.11.0

func (iDB *InternalDB) RemoveIPAllocationsDrv(tenant, id string) error

func (*InternalDB) RemoveIPProfileDrv added in v0.11.0

func (iDB *InternalDB) RemoveIPProfileDrv(tenant, id string) error

func (*InternalDB) RemoveIndexesDrv added in v0.11.0

func (iDB *InternalDB) RemoveIndexesDrv(idxItmType, tntCtx string, idxKeys ...string) (err error)

func (*InternalDB) RemoveKeysForPrefix added in v0.10.3

func (iDB *InternalDB) RemoveKeysForPrefix(prefix string) (err error)

func (*InternalDB) RemoveLoadIDsDrv

func (iDB *InternalDB) RemoveLoadIDsDrv() (err error)

func (*InternalDB) RemoveRankingDrv added in v0.11.0

func (iDB *InternalDB) RemoveRankingDrv(tenant, id string) (err error)

func (*InternalDB) RemoveRatingPlanDrv

func (iDB *InternalDB) RemoveRatingPlanDrv(id string) (err error)

func (*InternalDB) RemoveRatingProfileDrv

func (iDB *InternalDB) RemoveRatingProfileDrv(id string) (err error)

func (*InternalDB) RemoveResourceDrv

func (iDB *InternalDB) RemoveResourceDrv(tenant, id string) (err error)

func (*InternalDB) RemoveResourceProfileDrv

func (iDB *InternalDB) RemoveResourceProfileDrv(tenant, id string) (err error)

func (*InternalDB) RemoveReverseDestinationDrv added in v0.11.0

func (iDB *InternalDB) RemoveReverseDestinationDrv(dstID, prfx, transactionID string) (err error)

func (*InternalDB) RemoveRouteProfileDrv added in v0.11.0

func (iDB *InternalDB) RemoveRouteProfileDrv(tenant, id string) (err error)

func (*InternalDB) RemoveSMCost

func (iDB *InternalDB) RemoveSMCost(smc *SMCost) (err error)

func (*InternalDB) RemoveSMCosts

func (iDB *InternalDB) RemoveSMCosts(qryFltr *utils.SMCostFilter) error

func (*InternalDB) RemoveSessionsBackupDrv added in v0.11.0

func (iDB *InternalDB) RemoveSessionsBackupDrv(nodeID, tnt, cgrid string) error

Will remove one or all sessions from dataDB backup

func (*InternalDB) RemoveSharedGroupDrv

func (iDB *InternalDB) RemoveSharedGroupDrv(id string) (err error)

func (*InternalDB) RemoveThresholdDrv

func (iDB *InternalDB) RemoveThresholdDrv(tenant, id string) (err error)

func (*InternalDB) RemoveTimingDrv

func (iDB *InternalDB) RemoveTimingDrv(id string) (err error)

func (*InternalDB) RemoveTrendDrv added in v0.11.0

func (iDB *InternalDB) RemoveTrendDrv(tenant, id string) (err error)

func (*InternalDB) RemoveVersions

func (iDB *InternalDB) RemoveVersions(vrs Versions) (err error)

func (*InternalDB) RestoreDataDB added in v0.11.0

func (iDB *InternalDB) RestoreDataDB(backupFolderPath string) (err error)

RestoreDataDB will attempt to restore the internal DB from the latest backup in the specified backupPath. If backupPath is not specified, it will be taken from the default's backup path. Any data that was dumped from internal DB will be cleared before restoring from backup

func (*InternalDB) RestoreStorDB added in v0.11.0

func (iDB *InternalDB) RestoreStorDB(backupFolderPath string) (err error)

RestoreStorDB will attempt to restore the internal DB from the latest backup in the specified backupPath. If backupPath is not specified, it will be taken from the default's backup path. Any data that was dumped from internal DB will be cleared before restoring from backup

func (*InternalDB) RewriteDataDB added in v0.11.0

func (iDB *InternalDB) RewriteDataDB() (err error)

Will rewrite every dump file of DataDB

func (*InternalDB) RewriteStorDB added in v0.11.0

func (iDB *InternalDB) RewriteStorDB() (err error)

Will rewrite every dump file of StorDB

func (*InternalDB) SetAccountActionPlansDrv

func (iDB *InternalDB) SetAccountActionPlansDrv(acntID string, apIDs []string) (err error)

func (*InternalDB) SetAccountDrv

func (iDB *InternalDB) SetAccountDrv(acc *Account) (err error)

func (*InternalDB) SetActionPlanDrv

func (iDB *InternalDB) SetActionPlanDrv(key string, ats *ActionPlan) (err error)

func (*InternalDB) SetActionTriggersDrv

func (iDB *InternalDB) SetActionTriggersDrv(id string, at ActionTriggers) (err error)

func (*InternalDB) SetActionsDrv

func (iDB *InternalDB) SetActionsDrv(id string, acts Actions) (err error)

func (*InternalDB) SetAttributeProfileDrv

func (iDB *InternalDB) SetAttributeProfileDrv(attr *AttributeProfile) (err error)

func (*InternalDB) SetBackupSessionsDrv added in v0.11.0

func (iDB *InternalDB) SetBackupSessionsDrv(nodeID string,
	tnt string, storedSessions []*StoredSession) error

Will backup active sessions in DataDB

func (*InternalDB) SetCDR

func (iDB *InternalDB) SetCDR(cdr *CDR, allowUpdate bool) (err error)

implement CdrStorage interface

func (*InternalDB) SetChargerProfileDrv

func (iDB *InternalDB) SetChargerProfileDrv(chr *ChargerProfile) (err error)

func (*InternalDB) SetDestinationDrv

func (iDB *InternalDB) SetDestinationDrv(dest *Destination, transactionID string) (err error)

func (*InternalDB) SetDispatcherHostDrv

func (iDB *InternalDB) SetDispatcherHostDrv(dpp *DispatcherHost) (err error)

func (*InternalDB) SetDispatcherProfileDrv

func (iDB *InternalDB) SetDispatcherProfileDrv(dpp *DispatcherProfile) (err error)

func (*InternalDB) SetFilterDrv

func (iDB *InternalDB) SetFilterDrv(fltr *Filter) (err error)

func (*InternalDB) SetIPAllocationsDrv added in v0.11.0

func (iDB *InternalDB) SetIPAllocationsDrv(ip *IPAllocations) error

func (*InternalDB) SetIPProfileDrv added in v0.11.0

func (iDB *InternalDB) SetIPProfileDrv(ipp *IPProfile) error

func (*InternalDB) SetIndexesDrv added in v0.11.0

func (iDB *InternalDB) SetIndexesDrv(idxItmType, tntCtx string,
	indexes map[string]utils.StringSet, commit bool, transactionID string) (err error)

func (*InternalDB) SetLoadIDsDrv

func (iDB *InternalDB) SetLoadIDsDrv(loadIDs map[string]int64) (err error)

func (*InternalDB) SetPrefixIndexedFields

func (iDB *InternalDB) SetPrefixIndexedFields(prefixIndexedFields []string)

SetPrefixIndexedFields set the prefixIndexedFields, used at StorDB reload (is thread safe)

func (*InternalDB) SetRankingDrv added in v0.11.0

func (iDB *InternalDB) SetRankingDrv(rn *Ranking) (err error)

func (*InternalDB) SetRankingProfileDrv added in v0.11.0

func (iDB *InternalDB) SetRankingProfileDrv(sgp *RankingProfile) (err error)

func (*InternalDB) SetRatingPlanDrv

func (iDB *InternalDB) SetRatingPlanDrv(rp *RatingPlan) (err error)

func (*InternalDB) SetRatingProfileDrv

func (iDB *InternalDB) SetRatingProfileDrv(rp *RatingProfile) (err error)

func (*InternalDB) SetResourceDrv

func (iDB *InternalDB) SetResourceDrv(r *Resource) (err error)

func (*InternalDB) SetResourceProfileDrv

func (iDB *InternalDB) SetResourceProfileDrv(rp *ResourceProfile) (err error)

func (*InternalDB) SetReverseDestinationDrv

func (iDB *InternalDB) SetReverseDestinationDrv(destID string, prefixes []string, transactionID string) (err error)

func (*InternalDB) SetRouteProfileDrv added in v0.11.0

func (iDB *InternalDB) SetRouteProfileDrv(spp *RouteProfile) (err error)

func (*InternalDB) SetSMCost

func (iDB *InternalDB) SetSMCost(smCost *SMCost) (err error)

func (*InternalDB) SetSharedGroupDrv

func (iDB *InternalDB) SetSharedGroupDrv(sh *SharedGroup) (err error)

func (*InternalDB) SetStatQueueDrv

func (iDB *InternalDB) SetStatQueueDrv(ssq *StoredStatQueue, sq *StatQueue) (err error)

func (*InternalDB) SetStatQueueProfileDrv

func (iDB *InternalDB) SetStatQueueProfileDrv(sq *StatQueueProfile) (err error)

func (*InternalDB) SetStringIndexedFields

func (iDB *InternalDB) SetStringIndexedFields(stringIndexedFields []string)

SetStringIndexedFields set the stringIndexedFields, used at StorDB reload (is thread safe)

func (*InternalDB) SetTPAccountActions

func (iDB *InternalDB) SetTPAccountActions(accActions []*utils.TPAccountActions) (err error)

func (*InternalDB) SetTPActionPlans

func (iDB *InternalDB) SetTPActionPlans(aPlans []*utils.TPActionPlan) (err error)

func (*InternalDB) SetTPActionTriggers

func (iDB *InternalDB) SetTPActionTriggers(aTriggers []*utils.TPActionTriggers) (err error)

func (*InternalDB) SetTPActions

func (iDB *InternalDB) SetTPActions(acts []*utils.TPActions) (err error)

func (*InternalDB) SetTPAttributes

func (iDB *InternalDB) SetTPAttributes(attributes []*utils.TPAttributeProfile) (err error)

func (*InternalDB) SetTPChargers

func (iDB *InternalDB) SetTPChargers(cpps []*utils.TPChargerProfile) (err error)

func (*InternalDB) SetTPDestinationRates

func (iDB *InternalDB) SetTPDestinationRates(dRates []*utils.TPDestinationRate) (err error)

func (*InternalDB) SetTPDestinations

func (iDB *InternalDB) SetTPDestinations(dests []*utils.TPDestination) (err error)

func (*InternalDB) SetTPDispatcherHosts

func (iDB *InternalDB) SetTPDispatcherHosts(dpps []*utils.TPDispatcherHost) (err error)

func (*InternalDB) SetTPDispatcherProfiles

func (iDB *InternalDB) SetTPDispatcherProfiles(dpps []*utils.TPDispatcherProfile) (err error)

func (*InternalDB) SetTPFilters

func (iDB *InternalDB) SetTPFilters(filters []*utils.TPFilterProfile) (err error)

func (*InternalDB) SetTPIPs added in v0.11.0

func (iDB *InternalDB) SetTPIPs(ips []*utils.TPIPProfile) (err error)

func (*InternalDB) SetTPRankings added in v0.11.0

func (iDB *InternalDB) SetTPRankings(rankings []*utils.TPRankingProfile) (err error)

func (*InternalDB) SetTPRates

func (iDB *InternalDB) SetTPRates(rates []*utils.TPRateRALs) (err error)

func (*InternalDB) SetTPRatingPlans

func (iDB *InternalDB) SetTPRatingPlans(ratingPlans []*utils.TPRatingPlan) (err error)

func (*InternalDB) SetTPRatingProfiles

func (iDB *InternalDB) SetTPRatingProfiles(ratingProfiles []*utils.TPRatingProfile) (err error)

func (*InternalDB) SetTPResources

func (iDB *InternalDB) SetTPResources(resources []*utils.TPResourceProfile) (err error)

func (*InternalDB) SetTPRoutes added in v0.11.0

func (iDB *InternalDB) SetTPRoutes(routes []*utils.TPRouteProfile) (err error)

func (*InternalDB) SetTPSharedGroups

func (iDB *InternalDB) SetTPSharedGroups(groups []*utils.TPSharedGroups) (err error)

func (*InternalDB) SetTPStats

func (iDB *InternalDB) SetTPStats(stats []*utils.TPStatProfile) (err error)

func (*InternalDB) SetTPThresholds

func (iDB *InternalDB) SetTPThresholds(thresholds []*utils.TPThresholdProfile) (err error)

func (*InternalDB) SetTPTimings

func (iDB *InternalDB) SetTPTimings(timings []*utils.ApierTPTiming) (err error)

func (*InternalDB) SetTPTrends added in v0.11.0

func (iDB *InternalDB) SetTPTrends(trends []*utils.TPTrendsProfile) (err error)

func (*InternalDB) SetThresholdDrv

func (iDB *InternalDB) SetThresholdDrv(th *Threshold) (err error)

func (*InternalDB) SetThresholdProfileDrv

func (iDB *InternalDB) SetThresholdProfileDrv(tp *ThresholdProfile) (err error)

func (*InternalDB) SetTimingDrv

func (iDB *InternalDB) SetTimingDrv(timing *utils.TPTiming) (err error)

func (*InternalDB) SetTrendDrv added in v0.11.0

func (iDB *InternalDB) SetTrendDrv(tr *Trend) (err error)

func (*InternalDB) SetTrendProfileDrv added in v0.11.0

func (iDB *InternalDB) SetTrendProfileDrv(srp *TrendProfile) (err error)

func (*InternalDB) SetVersions

func (iDB *InternalDB) SetVersions(vrs Versions, overwrite bool) (err error)

func (*InternalDB) SnapshotDataDB added in v0.11.0

func (iDB *InternalDB) SnapshotDataDB(backupFolderPath string, zip bool) (err error)

SnapshotDataDB will take the BackupFolderPath (or default backup path if empty) to backup the live dump folder taking zip as parameter to zip the backup or not, after which it cleares the live dump folder and creates new dump files out of the live internal DB data

func (*InternalDB) SnapshotStorDB added in v0.11.0

func (iDB *InternalDB) SnapshotStorDB(backupFolderPath string, zip bool) (err error)

SnapshotStorDB will take the BackupFolderPath (or default backup path if empty) to backup the live dump folder taking zip as parameter to zip the backup or not, after which it cleares the live dump folder and creates new dump files out of the live internal DB data

type JSONBufMarshaler

type JSONBufMarshaler struct{}

func (*JSONBufMarshaler) Marshal

func (jbm *JSONBufMarshaler) Marshal(v any) (data []byte, err error)

func (*JSONBufMarshaler) Unmarshal

func (jbm *JSONBufMarshaler) Unmarshal(data []byte, v any) error

type JSONMarshaler

type JSONMarshaler struct{}

func (*JSONMarshaler) Marshal

func (jm *JSONMarshaler) Marshal(v any) ([]byte, error)

func (*JSONMarshaler) Unmarshal

func (jm *JSONMarshaler) Unmarshal(data []byte, v any) error

type LeastCostSorter

type LeastCostSorter struct {
	// contains filtered or unexported fields
}

LeastCostSorter sorts routes based on their cost

func NewLeastCostSorter

func NewLeastCostSorter(rS *RouteService) *LeastCostSorter

func (*LeastCostSorter) SortRoutes added in v0.11.0

func (lcs *LeastCostSorter) SortRoutes(prflID string, routes map[string]*Route,
	ev *utils.CGREvent, extraOpts *optsGetRoutes) (sortedRoutes *SortedRoutes, err error)

type LoadDistributionSorter

type LoadDistributionSorter struct {
	// contains filtered or unexported fields
}

LoadDistributionSorter orders suppliers based on their Resource Usage

func NewLoadDistributionSorter

func NewLoadDistributionSorter(rS *RouteService) *LoadDistributionSorter

NewLoadDistributionSorter .

func (*LoadDistributionSorter) SortRoutes added in v0.11.0

func (ws *LoadDistributionSorter) SortRoutes(prflID string,
	routes map[string]*Route, suplEv *utils.CGREvent, extraOpts *optsGetRoutes) (sortedRoutes *SortedRoutes, err error)

SortRoutes .

type LoadReader

type LoadReader interface {
	GetTpIds(string) ([]string, error)
	GetTpTableIds(string, string, utils.TPDistinctIds,
		map[string]string, *utils.PaginatorWithSearch) ([]string, error)
	GetTPTimings(string, string) ([]*utils.ApierTPTiming, error)
	GetTPDestinations(string, string) ([]*utils.TPDestination, error)
	GetTPRates(string, string) ([]*utils.TPRateRALs, error)
	GetTPDestinationRates(string, string, *utils.Paginator) ([]*utils.TPDestinationRate, error)
	GetTPRatingPlans(string, string, *utils.Paginator) ([]*utils.TPRatingPlan, error)
	GetTPRatingProfiles(*utils.TPRatingProfile) ([]*utils.TPRatingProfile, error)
	GetTPSharedGroups(string, string) ([]*utils.TPSharedGroups, error)
	GetTPActions(string, string) ([]*utils.TPActions, error)
	GetTPActionPlans(string, string) ([]*utils.TPActionPlan, error)
	GetTPActionTriggers(string, string) ([]*utils.TPActionTriggers, error)
	GetTPAccountActions(*utils.TPAccountActions) ([]*utils.TPAccountActions, error)
	GetTPResources(string, string, string) ([]*utils.TPResourceProfile, error)
	GetTPIPs(string, string, string) ([]*utils.TPIPProfile, error)
	GetTPStats(string, string, string) ([]*utils.TPStatProfile, error)
	GetTPTrends(string, string, string) ([]*utils.TPTrendsProfile, error)
	GetTPRankings(string, string, string) ([]*utils.TPRankingProfile, error)
	GetTPThresholds(string, string, string) ([]*utils.TPThresholdProfile, error)
	GetTPFilters(string, string, string) ([]*utils.TPFilterProfile, error)
	GetTPRoutes(string, string, string) ([]*utils.TPRouteProfile, error)
	GetTPAttributes(string, string, string) ([]*utils.TPAttributeProfile, error)
	GetTPChargers(string, string, string) ([]*utils.TPChargerProfile, error)
	GetTPDispatcherProfiles(string, string, string) ([]*utils.TPDispatcherProfile, error)
	GetTPDispatcherHosts(string, string, string) ([]*utils.TPDispatcherHost, error)
}

LoadReader reads from .csv or TP tables and provides the data ready for the tp_db or data_db.

type LoadStorage

type LoadStorage interface {
	Storage
	LoadReader
	LoadWriter
}

type LoadWriter

type LoadWriter interface {
	RemTpData(string, string, map[string]string) error
	SetTPTimings([]*utils.ApierTPTiming) error
	SetTPDestinations([]*utils.TPDestination) error
	SetTPRates([]*utils.TPRateRALs) error
	SetTPDestinationRates([]*utils.TPDestinationRate) error
	SetTPRatingPlans([]*utils.TPRatingPlan) error
	SetTPRatingProfiles([]*utils.TPRatingProfile) error
	SetTPSharedGroups([]*utils.TPSharedGroups) error
	SetTPActions([]*utils.TPActions) error
	SetTPActionPlans([]*utils.TPActionPlan) error
	SetTPActionTriggers([]*utils.TPActionTriggers) error
	SetTPAccountActions([]*utils.TPAccountActions) error
	SetTPResources([]*utils.TPResourceProfile) error
	SetTPIPs([]*utils.TPIPProfile) error
	SetTPStats([]*utils.TPStatProfile) error
	SetTPTrends([]*utils.TPTrendsProfile) error
	SetTPRankings([]*utils.TPRankingProfile) error
	SetTPThresholds([]*utils.TPThresholdProfile) error
	SetTPFilters([]*utils.TPFilterProfile) error
	SetTPRoutes([]*utils.TPRouteProfile) error
	SetTPAttributes([]*utils.TPAttributeProfile) error
	SetTPChargers([]*utils.TPChargerProfile) error
	SetTPDispatcherProfiles([]*utils.TPDispatcherProfile) error
	SetTPDispatcherHosts([]*utils.TPDispatcherHost) error
	DumpStorDB() error
	RewriteStorDB() error
	BackupStorDB(string, bool) error
	RestoreStorDB(string) error
	SnapshotStorDB(string, bool) error
}

type LowestBalancesSorter

type LowestBalancesSorter []*Balance

func (LowestBalancesSorter) Len

func (lbcs LowestBalancesSorter) Len() int

func (LowestBalancesSorter) Less

func (lbcs LowestBalancesSorter) Less(i, j int) bool

func (LowestBalancesSorter) Swap

func (lbcs LowestBalancesSorter) Swap(i, j int)

type MapEvent

type MapEvent map[string]any

MapEvent is a map[string]any with convenience methods on top

func NewMapEvent

func NewMapEvent(mp map[string]any) (me MapEvent)

NewMapEvent makes sure the content is not nil

func (MapEvent) AsCDR

func (me MapEvent) AsCDR(cfg *config.CGRConfig, tnt, tmz string) (cdr *CDR, err error)

AsCDR exports the MapEvent as CDR

func (MapEvent) AsMapString

func (me MapEvent) AsMapString(ignoredFlds utils.StringSet) (mp map[string]string)

AsMapString returns a map[string]string out of mp, ignoring specific fields if needed most used when needing to export extraFields

func (MapEvent) Clone

func (me MapEvent) Clone() (mp MapEvent)

Clone returns the cloned map

func (MapEvent) Data

func (me MapEvent) Data() map[string]any

Data returns the MapEvent as a map[string]any

func (MapEvent) FieldAsInterface

func (me MapEvent) FieldAsInterface(fldPath []string) (any, error)

func (MapEvent) FieldAsString

func (me MapEvent) FieldAsString(fldPath []string) (string, error)

func (MapEvent) GetBoolOrDefault added in v0.11.0

func (me MapEvent) GetBoolOrDefault(fldName string, dflt bool) (out bool)

GetBoolOrDefault returns the value as a bool or dflt if not present in map

func (MapEvent) GetDuration

func (me MapEvent) GetDuration(fldName string) (d time.Duration, err error)

GetDuration returns a field as Duration

func (MapEvent) GetDurationIgnoreErrors

func (me MapEvent) GetDurationIgnoreErrors(fldName string) (d time.Duration)

GetDuration returns a field as Duration, ignoring errors

func (MapEvent) GetDurationPtr

func (me MapEvent) GetDurationPtr(fldName string) (d *time.Duration, err error)

GetDurationPointer returns pointer towards duration, useful to detect presence of duration

func (MapEvent) GetDurationPtrIgnoreErrors

func (me MapEvent) GetDurationPtrIgnoreErrors(fldName string) (d *time.Duration)

GetDurationPointer returns pointer towards duration, useful to detect presence of duration

func (MapEvent) GetDurationPtrOrDefault

func (me MapEvent) GetDurationPtrOrDefault(fldName string, dflt *time.Duration) (d *time.Duration, err error)

GetDurationPtrOrDefault returns pointer or default if fldName is missing

func (MapEvent) GetFloat64 added in v0.11.0

func (me MapEvent) GetFloat64(fldName string) (f float64, err error)

GetFloat64 returns a field as float64 instance

func (MapEvent) GetString

func (me MapEvent) GetString(fldName string) (out string, err error)

func (MapEvent) GetStringIgnoreErrors

func (me MapEvent) GetStringIgnoreErrors(fldName string) (out string)

func (MapEvent) GetTInt64

func (me MapEvent) GetTInt64(fldName string) (out int64, err error)

func (MapEvent) GetTime

func (me MapEvent) GetTime(fldName string, timezone string) (t time.Time, err error)

GetTime returns a field as Time

func (MapEvent) GetTimeIgnoreErrors

func (me MapEvent) GetTimeIgnoreErrors(fldName string, tmz string) (t time.Time)

GetTimeIgnoreErrors returns a field as Time instance, ignoring errors

func (MapEvent) GetTimePtr

func (me MapEvent) GetTimePtr(fldName, tmz string) (t *time.Time, err error)

GetTimePtr returns a pointer towards time or error

func (MapEvent) GetTimePtrIgnoreErrors

func (me MapEvent) GetTimePtrIgnoreErrors(fldName, tmz string) (t *time.Time)

GetTimePtrIgnoreErrors returns a pointer towards time or nil if errors

func (MapEvent) HasField

func (me MapEvent) HasField(fldName string) (has bool)

func (MapEvent) String

func (me MapEvent) String() string

type Marshaler

type Marshaler interface {
	Marshal(v any) ([]byte, error)
	Unmarshal(data []byte, v any) error
}

func NewMarshaler

func NewMarshaler(mrshlerStr string) (ms Marshaler, err error)

NewMarshaler returns the marshaler type selected by mrshlerStr

type MetricWithFilters

type MetricWithFilters struct {
	FilterIDs []string
	MetricID  string
}

func (*MetricWithFilters) Clone added in v0.11.0

func (mwf *MetricWithFilters) Clone() *MetricWithFilters

Clone clones *MetricWithFilters

type MetricWithTrend added in v0.11.0

type MetricWithTrend struct {
	ID          string  // Metric ID
	Value       float64 // Metric Value
	TrendGrowth float64 // Difference between last and previous
	TrendLabel  string  // *positive, *negative, *constant, N/A
}

MetricWithTrend represents one read from StatS

type MonetaryInfo

type MonetaryInfo struct {
	UUID         string
	ID           string
	Value        float64
	RateInterval *RateInterval
}

func (*MonetaryInfo) Clone

func (mi *MonetaryInfo) Clone() *MonetaryInfo

func (*MonetaryInfo) Equal

func (mi *MonetaryInfo) Equal(other *MonetaryInfo) bool

type MongoStorage

type MongoStorage struct {
	// contains filtered or unexported fields
}

MongoStorage represents a storage interface for the new MongoDB driver.

func NewMongoStorage

func NewMongoStorage(scheme, host, port, db, user, pass, mrshlerStr string, storageType string,
	cdrsIndexes []string, ttl time.Duration) (*MongoStorage, error)

NewMongoStorage initializes a new MongoDB storage instance with provided connection parameters and settings. Returns an error if the setup fails.

func (*MongoStorage) AddLoadHistory

func (ms *MongoStorage) AddLoadHistory(ldInst *utils.LoadInstance,
	loadHistSize int, transactionID string) error

AddLoadHistory adds a single load instance to the load history.

func (*MongoStorage) BackupDataDB added in v0.11.0

func (ms *MongoStorage) BackupDataDB(backupFolderPath string, zip bool) (err error)

BackupDataDB only for InternalDB

func (*MongoStorage) BackupStorDB added in v0.11.0

func (ms *MongoStorage) BackupStorDB(backupFolderPath string, zip bool) (err error)

BackupStorDB used only for InternalDB

func (*MongoStorage) Close

func (ms *MongoStorage) Close()

Close disconnects the MongoDB client.

func (*MongoStorage) DB

func (ms *MongoStorage) DB() *mongo.Database

DB returns the database object associated with the MongoDB client.

func (*MongoStorage) DumpDataDB added in v0.11.0

func (ms *MongoStorage) DumpDataDB() error

DumpDataDB will dump all of datadb from memory to a file, only for InternalDB

func (*MongoStorage) DumpStorDB added in v0.11.0

func (ms *MongoStorage) DumpStorDB() (err error)

RewriteStorDB used only for InternalDB

func (*MongoStorage) EnsureIndexes

func (ms *MongoStorage) EnsureIndexes(cols ...string) error

EnsureIndexes creates database indexes for the specified collections.

func (*MongoStorage) Flush

func (ms *MongoStorage) Flush(_ string) (err error)

Flush drops the datatable and recreates the indexes.

func (*MongoStorage) GetAccountActionPlansDrv

func (ms *MongoStorage) GetAccountActionPlansDrv(acntID string) ([]string, error)

func (*MongoStorage) GetAccountDrv

func (ms *MongoStorage) GetAccountDrv(key string) (*Account, error)

func (*MongoStorage) GetActionPlanDrv

func (ms *MongoStorage) GetActionPlanDrv(key string) (*ActionPlan, error)

func (*MongoStorage) GetActionTriggersDrv

func (ms *MongoStorage) GetActionTriggersDrv(key string) (ActionTriggers, error)

func (*MongoStorage) GetActionsDrv

func (ms *MongoStorage) GetActionsDrv(key string) (Actions, error)

func (*MongoStorage) GetAllActionPlansDrv

func (ms *MongoStorage) GetAllActionPlansDrv() (map[string]*ActionPlan, error)

func (*MongoStorage) GetAttributeProfileDrv

func (ms *MongoStorage) GetAttributeProfileDrv(tenant, id string) (*AttributeProfile, error)

func (*MongoStorage) GetCDRs

func (ms *MongoStorage) GetCDRs(qryFltr *utils.CDRsFilter, remove bool) (cdrs []*CDR, n int64, err error)

_, err := col(ColCDRs).UpdateAll(bson.M{CGRIDLow: bson.M{"$in": cgrIds}}, bson.M{"$set": bson.M{"deleted_at": time.Now()}})

func (*MongoStorage) GetChargerProfileDrv

func (ms *MongoStorage) GetChargerProfileDrv(tenant, id string) (*ChargerProfile, error)

func (*MongoStorage) GetContext

func (ms *MongoStorage) GetContext() context.Context

GetContext returns the context used for the current database.

func (*MongoStorage) GetDestinationDrv

func (ms *MongoStorage) GetDestinationDrv(key, transactionID string) (*Destination, error)

func (*MongoStorage) GetDispatcherHostDrv

func (ms *MongoStorage) GetDispatcherHostDrv(tenant, id string) (*DispatcherHost, error)

func (*MongoStorage) GetDispatcherProfileDrv

func (ms *MongoStorage) GetDispatcherProfileDrv(tenant, id string) (*DispatcherProfile, error)

func (*MongoStorage) GetFilterDrv

func (ms *MongoStorage) GetFilterDrv(tenant, id string) (*Filter, error)

func (*MongoStorage) GetIPAllocationsDrv added in v0.11.0

func (ms *MongoStorage) GetIPAllocationsDrv(tenant, id string) (*IPAllocations, error)

func (*MongoStorage) GetIPProfileDrv added in v0.11.0

func (ms *MongoStorage) GetIPProfileDrv(tenant, id string) (*IPProfile, error)

func (*MongoStorage) GetIndexesDrv added in v0.11.0

func (ms *MongoStorage) GetIndexesDrv(idxItmType, tntCtx string, idxKeys ...string) (map[string]utils.StringSet, error)

GetIndexesDrv retrieves Indexes from dataDB the key is the tenant of the item or in case of context dependent profiles is a concatenatedKey between tenant and context id is used as a concatenated key in case of filterIndexes the id will be filterType:fieldName:fieldVal

func (*MongoStorage) GetItemLoadIDsDrv

func (ms *MongoStorage) GetItemLoadIDsDrv(itemIDPrefix string) (map[string]int64, error)

func (*MongoStorage) GetKeysForPrefix

func (ms *MongoStorage) GetKeysForPrefix(prefix, search string) (keys []string, err error)

GetKeysForPrefix retrieves keys matching the specified prefix across different categories.

func (*MongoStorage) GetLoadHistory

func (ms *MongoStorage) GetLoadHistory(limit int, skipCache bool,
	transactionID string) ([]*utils.LoadInstance, error)

GetLoadHistory retrieves the last n items from the load history, newest first.

func (*MongoStorage) GetRankingDrv added in v0.11.0

func (ms *MongoStorage) GetRankingDrv(tenant, id string) (*Ranking, error)

func (*MongoStorage) GetRankingProfileDrv added in v0.11.0

func (ms *MongoStorage) GetRankingProfileDrv(tenant, id string) (*RankingProfile, error)

func (*MongoStorage) GetRatingPlanDrv

func (ms *MongoStorage) GetRatingPlanDrv(key string) (*RatingPlan, error)

func (*MongoStorage) GetRatingProfileDrv

func (ms *MongoStorage) GetRatingProfileDrv(key string) (*RatingProfile, error)

func (*MongoStorage) GetResourceDrv

func (ms *MongoStorage) GetResourceDrv(tenant, id string) (*Resource, error)

func (*MongoStorage) GetResourceProfileDrv

func (ms *MongoStorage) GetResourceProfileDrv(tenant, id string) (*ResourceProfile, error)

func (*MongoStorage) GetReverseDestinationDrv

func (ms *MongoStorage) GetReverseDestinationDrv(prefix, transactionID string) ([]string, error)

func (*MongoStorage) GetRouteProfileDrv added in v0.11.0

func (ms *MongoStorage) GetRouteProfileDrv(tenant, id string) (*RouteProfile, error)

func (*MongoStorage) GetSMCosts

func (ms *MongoStorage) GetSMCosts(cgrid, runid, originHost, originIDPrefix string) (smcs []*SMCost, err error)

func (*MongoStorage) GetSessionsBackupDrv added in v0.11.0

func (ms *MongoStorage) GetSessionsBackupDrv(nodeID, tnt string) ([]*StoredSession, error)

Will restore sessions that were active from dataDB backup

func (*MongoStorage) GetSharedGroupDrv

func (ms *MongoStorage) GetSharedGroupDrv(key string) (*SharedGroup, error)

func (*MongoStorage) GetStatQueueDrv

func (ms *MongoStorage) GetStatQueueDrv(tenant, id string) (*StatQueue, error)

GetStatQueueDrv retrieves a StoredStatQueue

func (*MongoStorage) GetStatQueueProfileDrv

func (ms *MongoStorage) GetStatQueueProfileDrv(tenant string, id string) (*StatQueueProfile, error)

GetStatQueueProfileDrv retrieves a StatQueueProfile from dataDB

func (*MongoStorage) GetStorageType

func (ms *MongoStorage) GetStorageType() string

func (*MongoStorage) GetTPAccountActions

func (ms *MongoStorage) GetTPAccountActions(tp *utils.TPAccountActions) ([]*utils.TPAccountActions, error)

func (*MongoStorage) GetTPActionPlans

func (ms *MongoStorage) GetTPActionPlans(tpid, id string) ([]*utils.TPActionPlan, error)

func (*MongoStorage) GetTPActionTriggers

func (ms *MongoStorage) GetTPActionTriggers(tpid, id string) ([]*utils.TPActionTriggers, error)

func (*MongoStorage) GetTPActions

func (ms *MongoStorage) GetTPActions(tpid, id string) ([]*utils.TPActions, error)

func (*MongoStorage) GetTPAttributes

func (ms *MongoStorage) GetTPAttributes(tpid, tenant, id string) ([]*utils.TPAttributeProfile, error)

func (*MongoStorage) GetTPChargers

func (ms *MongoStorage) GetTPChargers(tpid, tenant, id string) ([]*utils.TPChargerProfile, error)

func (*MongoStorage) GetTPDestinationRates

func (ms *MongoStorage) GetTPDestinationRates(tpid, id string, pag *utils.Paginator) ([]*utils.TPDestinationRate, error)

func (*MongoStorage) GetTPDestinations

func (ms *MongoStorage) GetTPDestinations(tpid, id string) ([]*utils.TPDestination, error)

func (*MongoStorage) GetTPDispatcherHosts

func (ms *MongoStorage) GetTPDispatcherHosts(tpid, tenant, id string) ([]*utils.TPDispatcherHost, error)

func (*MongoStorage) GetTPDispatcherProfiles

func (ms *MongoStorage) GetTPDispatcherProfiles(tpid, tenant, id string) ([]*utils.TPDispatcherProfile, error)

func (*MongoStorage) GetTPFilters

func (ms *MongoStorage) GetTPFilters(tpid, tenant, id string) ([]*utils.TPFilterProfile, error)

func (*MongoStorage) GetTPIPs added in v0.11.0

func (ms *MongoStorage) GetTPIPs(tpid, tenant, id string) ([]*utils.TPIPProfile, error)

func (*MongoStorage) GetTPRankings added in v0.11.0

func (ms *MongoStorage) GetTPRankings(tpid string, tenant string, id string) ([]*utils.TPRankingProfile, error)

func (*MongoStorage) GetTPRates

func (ms *MongoStorage) GetTPRates(tpid, id string) ([]*utils.TPRateRALs, error)

func (*MongoStorage) GetTPRatingPlans

func (ms *MongoStorage) GetTPRatingPlans(tpid, id string, pag *utils.Paginator) ([]*utils.TPRatingPlan, error)

func (*MongoStorage) GetTPRatingProfiles

func (ms *MongoStorage) GetTPRatingProfiles(tp *utils.TPRatingProfile) ([]*utils.TPRatingProfile, error)

func (*MongoStorage) GetTPResources

func (ms *MongoStorage) GetTPResources(tpid, tenant, id string) ([]*utils.TPResourceProfile, error)

func (*MongoStorage) GetTPRoutes added in v0.11.0

func (ms *MongoStorage) GetTPRoutes(tpid, tenant, id string) ([]*utils.TPRouteProfile, error)

func (*MongoStorage) GetTPSharedGroups

func (ms *MongoStorage) GetTPSharedGroups(tpid, id string) ([]*utils.TPSharedGroups, error)

func (*MongoStorage) GetTPStats

func (ms *MongoStorage) GetTPStats(tpid, tenant, id string) ([]*utils.TPStatProfile, error)

func (*MongoStorage) GetTPThresholds

func (ms *MongoStorage) GetTPThresholds(tpid, tenant, id string) ([]*utils.TPThresholdProfile, error)

func (*MongoStorage) GetTPTimings

func (ms *MongoStorage) GetTPTimings(tpid, id string) ([]*utils.ApierTPTiming, error)

func (*MongoStorage) GetTPTrends added in v0.11.0

func (ms *MongoStorage) GetTPTrends(tpid string, tenant string, id string) ([]*utils.TPTrendsProfile, error)

func (*MongoStorage) GetThresholdDrv

func (ms *MongoStorage) GetThresholdDrv(tenant, id string) (*Threshold, error)

func (*MongoStorage) GetThresholdProfileDrv

func (ms *MongoStorage) GetThresholdProfileDrv(tenant, ID string) (*ThresholdProfile, error)

GetThresholdProfileDrv retrieves a ThresholdProfile from dataDB

func (*MongoStorage) GetTimingDrv

func (ms *MongoStorage) GetTimingDrv(id string) (*utils.TPTiming, error)

func (*MongoStorage) GetTpIds

func (ms *MongoStorage) GetTpIds(colName string) (tpids []string, err error)

func (*MongoStorage) GetTpTableIds

func (ms *MongoStorage) GetTpTableIds(tpid, table string, distinctIDs utils.TPDistinctIds,
	filter map[string]string, pag *utils.PaginatorWithSearch) ([]string, error)

func (*MongoStorage) GetTrendDrv added in v0.11.0

func (ms *MongoStorage) GetTrendDrv(tenant, id string) (*Trend, error)

func (*MongoStorage) GetTrendProfileDrv added in v0.11.0

func (ms *MongoStorage) GetTrendProfileDrv(tenant, id string) (*TrendProfile, error)

func (*MongoStorage) GetVersions

func (ms *MongoStorage) GetVersions(itm string) (Versions, error)

func (*MongoStorage) HasDataDrv

func (ms *MongoStorage) HasDataDrv(category, subject, tenant string) (has bool, err error)

func (*MongoStorage) IsDBEmpty

func (ms *MongoStorage) IsDBEmpty() (isEmpty bool, err error)

IsDBEmpty checks if the database is empty by verifying if each collection is empty.

func (*MongoStorage) IsDataDB

func (ms *MongoStorage) IsDataDB() bool

IsDataDB returns whether or not the storage is used for DataDB.

func (*MongoStorage) PopTask

func (ms *MongoStorage) PopTask() (*Task, error)

func (*MongoStorage) PushTask

func (ms *MongoStorage) PushTask(t *Task) error

func (*MongoStorage) RemAccountActionPlansDrv

func (ms *MongoStorage) RemAccountActionPlansDrv(acntID string) error

ToDo: check return len(aPlIDs) == 0

func (*MongoStorage) RemRankingProfileDrv added in v0.11.0

func (ms *MongoStorage) RemRankingProfileDrv(tenant, id string) (err error)

func (*MongoStorage) RemStatQueueDrv

func (ms *MongoStorage) RemStatQueueDrv(tenant, id string) error

RemStatQueueDrv removes stored metrics for a StoredStatQueue

func (*MongoStorage) RemStatQueueProfileDrv

func (ms *MongoStorage) RemStatQueueProfileDrv(tenant, id string) error

RemStatQueueProfileDrv removes a StatsQueue from dataDB

func (*MongoStorage) RemThresholdProfileDrv

func (ms *MongoStorage) RemThresholdProfileDrv(tenant, id string) error

RemoveThresholdProfile removes a ThresholdProfile from dataDB/cache

func (*MongoStorage) RemTpData

func (ms *MongoStorage) RemTpData(table, tpid string, args map[string]string) error

func (*MongoStorage) RemTrendProfileDrv added in v0.11.0

func (ms *MongoStorage) RemTrendProfileDrv(tenant, id string) (err error)

func (*MongoStorage) RemoveAccountDrv

func (ms *MongoStorage) RemoveAccountDrv(key string) error

func (*MongoStorage) RemoveActionPlanDrv

func (ms *MongoStorage) RemoveActionPlanDrv(key string) error

func (*MongoStorage) RemoveActionTriggersDrv

func (ms *MongoStorage) RemoveActionTriggersDrv(key string) error

func (*MongoStorage) RemoveActionsDrv

func (ms *MongoStorage) RemoveActionsDrv(key string) error

func (*MongoStorage) RemoveAttributeProfileDrv

func (ms *MongoStorage) RemoveAttributeProfileDrv(tenant, id string) error

func (*MongoStorage) RemoveChargerProfileDrv

func (ms *MongoStorage) RemoveChargerProfileDrv(tenant, id string) error

func (*MongoStorage) RemoveDestinationDrv

func (ms *MongoStorage) RemoveDestinationDrv(destID string,
	transactionID string) error

func (*MongoStorage) RemoveDispatcherHostDrv

func (ms *MongoStorage) RemoveDispatcherHostDrv(tenant, id string) error

func (*MongoStorage) RemoveDispatcherProfileDrv

func (ms *MongoStorage) RemoveDispatcherProfileDrv(tenant, id string) error

func (*MongoStorage) RemoveFilterDrv

func (ms *MongoStorage) RemoveFilterDrv(tenant, id string) error

func (*MongoStorage) RemoveIPAllocationsDrv added in v0.11.0

func (ms *MongoStorage) RemoveIPAllocationsDrv(tenant, id string) error

func (*MongoStorage) RemoveIPProfileDrv added in v0.11.0

func (ms *MongoStorage) RemoveIPProfileDrv(tenant, id string) error

func (*MongoStorage) RemoveIndexesDrv added in v0.11.0

func (ms *MongoStorage) RemoveIndexesDrv(idxItmType, tntCtx string, idxKeys ...string) error

RemoveIndexesDrv removes the indexes

func (*MongoStorage) RemoveKeysForPrefix added in v0.10.3

func (ms *MongoStorage) RemoveKeysForPrefix(prefix string) error

func (*MongoStorage) RemoveLoadIDsDrv

func (ms *MongoStorage) RemoveLoadIDsDrv() error

func (*MongoStorage) RemoveRankingDrv added in v0.11.0

func (ms *MongoStorage) RemoveRankingDrv(tenant, id string) error

func (*MongoStorage) RemoveRatingPlanDrv

func (ms *MongoStorage) RemoveRatingPlanDrv(key string) error

func (*MongoStorage) RemoveRatingProfileDrv

func (ms *MongoStorage) RemoveRatingProfileDrv(key string) error

func (*MongoStorage) RemoveResourceDrv

func (ms *MongoStorage) RemoveResourceDrv(tenant, id string) error

func (*MongoStorage) RemoveResourceProfileDrv

func (ms *MongoStorage) RemoveResourceProfileDrv(tenant, id string) error

func (*MongoStorage) RemoveReverseDestinationDrv added in v0.11.0

func (ms *MongoStorage) RemoveReverseDestinationDrv(dstID, prfx, transactionID string) error

func (*MongoStorage) RemoveRouteProfileDrv added in v0.11.0

func (ms *MongoStorage) RemoveRouteProfileDrv(tenant, id string) error

func (*MongoStorage) RemoveSMCost

func (ms *MongoStorage) RemoveSMCost(smc *SMCost) error

func (*MongoStorage) RemoveSMCosts

func (ms *MongoStorage) RemoveSMCosts(qryFltr *utils.SMCostFilter) error

func (*MongoStorage) RemoveSessionsBackupDrv added in v0.11.0

func (ms *MongoStorage) RemoveSessionsBackupDrv(nodeID, tnt, cgrid string) error

Will remove one or all sessions from dataDB Backup

func (*MongoStorage) RemoveSharedGroupDrv

func (ms *MongoStorage) RemoveSharedGroupDrv(id string) error

func (*MongoStorage) RemoveThresholdDrv

func (ms *MongoStorage) RemoveThresholdDrv(tenant, id string) error

func (*MongoStorage) RemoveTimingDrv

func (ms *MongoStorage) RemoveTimingDrv(id string) error

func (*MongoStorage) RemoveTrendDrv added in v0.11.0

func (ms *MongoStorage) RemoveTrendDrv(tenant, id string) error

func (*MongoStorage) RemoveVersions

func (ms *MongoStorage) RemoveVersions(vrs Versions) error

func (*MongoStorage) RestoreDataDB added in v0.11.0

func (ms *MongoStorage) RestoreDataDB(backupFolderPath string) (err error)

RestoreDataDB only for InternalDB

func (*MongoStorage) RestoreStorDB added in v0.11.0

func (ms *MongoStorage) RestoreStorDB(backupFolderPath string) (err error)

RestoreStorDB used only for InternalDB

func (*MongoStorage) RewriteDataDB added in v0.11.0

func (ms *MongoStorage) RewriteDataDB() (err error)

Will rewrite every dump file of DataDB, only for InternalDB

func (*MongoStorage) RewriteStorDB added in v0.11.0

func (ms *MongoStorage) RewriteStorDB() (err error)

RewriteStorDB used only for InternalDB

func (*MongoStorage) SetAccountActionPlansDrv

func (ms *MongoStorage) SetAccountActionPlansDrv(acntID string, aPlIDs []string) error

func (*MongoStorage) SetAccountDrv

func (ms *MongoStorage) SetAccountDrv(acc *Account) error

func (*MongoStorage) SetActionPlanDrv

func (ms *MongoStorage) SetActionPlanDrv(key string, ats *ActionPlan) error

func (*MongoStorage) SetActionTriggersDrv

func (ms *MongoStorage) SetActionTriggersDrv(key string, atrs ActionTriggers) error

func (*MongoStorage) SetActionsDrv

func (ms *MongoStorage) SetActionsDrv(key string, as Actions) error

func (*MongoStorage) SetAttributeProfileDrv

func (ms *MongoStorage) SetAttributeProfileDrv(r *AttributeProfile) error

func (*MongoStorage) SetBackupSessionsDrv added in v0.11.0

func (ms *MongoStorage) SetBackupSessionsDrv(nodeID, tnt string, storedSessions []*StoredSession) error

Will backup active sessions in DataDB

func (*MongoStorage) SetCDR

func (ms *MongoStorage) SetCDR(cdr *CDR, allowUpdate bool) error

func (*MongoStorage) SetChargerProfileDrv

func (ms *MongoStorage) SetChargerProfileDrv(r *ChargerProfile) error

func (*MongoStorage) SetDestinationDrv

func (ms *MongoStorage) SetDestinationDrv(dest *Destination, _ string) error

func (*MongoStorage) SetDispatcherHostDrv

func (ms *MongoStorage) SetDispatcherHostDrv(r *DispatcherHost) error

func (*MongoStorage) SetDispatcherProfileDrv

func (ms *MongoStorage) SetDispatcherProfileDrv(r *DispatcherProfile) error

func (*MongoStorage) SetFilterDrv

func (ms *MongoStorage) SetFilterDrv(r *Filter) error

func (*MongoStorage) SetIPAllocationsDrv added in v0.11.0

func (ms *MongoStorage) SetIPAllocationsDrv(ip *IPAllocations) error

func (*MongoStorage) SetIPProfileDrv added in v0.11.0

func (ms *MongoStorage) SetIPProfileDrv(ip *IPProfile) error

func (*MongoStorage) SetIndexesDrv added in v0.11.0

func (ms *MongoStorage) SetIndexesDrv(idxItmType, tntCtx string,
	indexes map[string]utils.StringSet, commit bool, transactionID string) error

SetIndexesDrv stores Indexes into DataDB the key is the tenant of the item or in case of context dependent profiles is a concatenatedKey between tenant and context

func (*MongoStorage) SetLoadIDsDrv

func (ms *MongoStorage) SetLoadIDsDrv(loadIDs map[string]int64) error

func (*MongoStorage) SetRankingDrv added in v0.11.0

func (ms *MongoStorage) SetRankingDrv(rn *Ranking) error

func (*MongoStorage) SetRankingProfileDrv added in v0.11.0

func (ms *MongoStorage) SetRankingProfileDrv(sgp *RankingProfile) (err error)

func (*MongoStorage) SetRatingPlanDrv

func (ms *MongoStorage) SetRatingPlanDrv(rp *RatingPlan) error

func (*MongoStorage) SetRatingProfileDrv

func (ms *MongoStorage) SetRatingProfileDrv(rp *RatingProfile) error

func (*MongoStorage) SetResourceDrv

func (ms *MongoStorage) SetResourceDrv(r *Resource) error

func (*MongoStorage) SetResourceProfileDrv

func (ms *MongoStorage) SetResourceProfileDrv(rp *ResourceProfile) error

func (*MongoStorage) SetReverseDestinationDrv

func (ms *MongoStorage) SetReverseDestinationDrv(destID string, prefixes []string, _ string) error

func (*MongoStorage) SetRouteProfileDrv added in v0.11.0

func (ms *MongoStorage) SetRouteProfileDrv(r *RouteProfile) error

func (*MongoStorage) SetSMCost

func (ms *MongoStorage) SetSMCost(smc *SMCost) error

func (*MongoStorage) SetSharedGroupDrv

func (ms *MongoStorage) SetSharedGroupDrv(sg *SharedGroup) error

func (*MongoStorage) SetStatQueueDrv

func (ms *MongoStorage) SetStatQueueDrv(ssq *StoredStatQueue, sq *StatQueue) (err error)

SetStatQueueDrv stores the metrics for a StoredStatQueue

func (*MongoStorage) SetStatQueueProfileDrv

func (ms *MongoStorage) SetStatQueueProfileDrv(sq *StatQueueProfile) error

SetStatQueueProfileDrv stores a StatsQueue into DataDB

func (*MongoStorage) SetTPAccountActions

func (ms *MongoStorage) SetTPAccountActions(tps []*utils.TPAccountActions) error

func (*MongoStorage) SetTPActionPlans

func (ms *MongoStorage) SetTPActionPlans(tps []*utils.TPActionPlan) error

func (*MongoStorage) SetTPActionTriggers

func (ms *MongoStorage) SetTPActionTriggers(tps []*utils.TPActionTriggers) error

func (*MongoStorage) SetTPActions

func (ms *MongoStorage) SetTPActions(tps []*utils.TPActions) error

func (*MongoStorage) SetTPAttributes

func (ms *MongoStorage) SetTPAttributes(tpRoutes []*utils.TPAttributeProfile) (err error)

func (*MongoStorage) SetTPChargers

func (ms *MongoStorage) SetTPChargers(tpCPP []*utils.TPChargerProfile) (err error)

func (*MongoStorage) SetTPDestinationRates

func (ms *MongoStorage) SetTPDestinationRates(tps []*utils.TPDestinationRate) error

func (*MongoStorage) SetTPDestinations

func (ms *MongoStorage) SetTPDestinations(tpDsts []*utils.TPDestination) (err error)

func (*MongoStorage) SetTPDispatcherHosts

func (ms *MongoStorage) SetTPDispatcherHosts(tpDPPs []*utils.TPDispatcherHost) (err error)

func (*MongoStorage) SetTPDispatcherProfiles

func (ms *MongoStorage) SetTPDispatcherProfiles(tpDPPs []*utils.TPDispatcherProfile) (err error)

func (*MongoStorage) SetTPFilters

func (ms *MongoStorage) SetTPFilters(tpTHs []*utils.TPFilterProfile) (err error)

func (*MongoStorage) SetTPIPs added in v0.11.0

func (ms *MongoStorage) SetTPIPs(tps []*utils.TPIPProfile) (err error)

func (*MongoStorage) SetTPRStats

func (ms *MongoStorage) SetTPRStats(tps []*utils.TPStatProfile) (err error)

func (*MongoStorage) SetTPRankings added in v0.11.0

func (ms *MongoStorage) SetTPRankings(tpRankings []*utils.TPRankingProfile) (err error)

func (*MongoStorage) SetTPRates

func (ms *MongoStorage) SetTPRates(tps []*utils.TPRateRALs) error

func (*MongoStorage) SetTPRatingPlans

func (ms *MongoStorage) SetTPRatingPlans(tps []*utils.TPRatingPlan) error

func (*MongoStorage) SetTPRatingProfiles

func (ms *MongoStorage) SetTPRatingProfiles(tps []*utils.TPRatingProfile) error

func (*MongoStorage) SetTPResources

func (ms *MongoStorage) SetTPResources(tpRLs []*utils.TPResourceProfile) (err error)

func (*MongoStorage) SetTPRoutes added in v0.11.0

func (ms *MongoStorage) SetTPRoutes(tpRoutes []*utils.TPRouteProfile) (err error)

func (*MongoStorage) SetTPSharedGroups

func (ms *MongoStorage) SetTPSharedGroups(tps []*utils.TPSharedGroups) error

func (*MongoStorage) SetTPStats

func (ms *MongoStorage) SetTPStats(tpSTs []*utils.TPStatProfile) (err error)

func (*MongoStorage) SetTPThresholds

func (ms *MongoStorage) SetTPThresholds(tpTHs []*utils.TPThresholdProfile) (err error)

func (*MongoStorage) SetTPTimings

func (ms *MongoStorage) SetTPTimings(tps []*utils.ApierTPTiming) error

func (*MongoStorage) SetTPTrends added in v0.11.0

func (ms *MongoStorage) SetTPTrends(tpTrends []*utils.TPTrendsProfile) (err error)

func (*MongoStorage) SetTTL

func (ms *MongoStorage) SetTTL(ttl time.Duration)

SetTTL sets the context TTL used for queries (Thread-safe).

func (*MongoStorage) SetThresholdDrv

func (ms *MongoStorage) SetThresholdDrv(r *Threshold) error

func (*MongoStorage) SetThresholdProfileDrv

func (ms *MongoStorage) SetThresholdProfileDrv(tp *ThresholdProfile) error

SetThresholdProfileDrv stores a ThresholdProfile into DataDB

func (*MongoStorage) SetTimingDrv

func (ms *MongoStorage) SetTimingDrv(t *utils.TPTiming) error

func (*MongoStorage) SetTrendDrv added in v0.11.0

func (ms *MongoStorage) SetTrendDrv(tr *Trend) error

func (*MongoStorage) SetTrendProfileDrv added in v0.11.0

func (ms *MongoStorage) SetTrendProfileDrv(srp *TrendProfile) (err error)

func (*MongoStorage) SetVersions

func (ms *MongoStorage) SetVersions(vrs Versions, overwrite bool) error

func (*MongoStorage) SnapshotDataDB added in v0.11.0

func (ms *MongoStorage) SnapshotDataDB(backupFolderPath string, zip bool) (err error)

SnapshotDataDB only for InternalDB

func (*MongoStorage) SnapshotStorDB added in v0.11.0

func (ms *MongoStorage) SnapshotStorDB(backupFolderPath string, zip bool) (err error)

SnapshotStorDB used only for InternalDB

type MySQLStorage

type MySQLStorage struct {
	SQLStorage
}

func (*MySQLStorage) GetStorageType

func (msqlS *MySQLStorage) GetStorageType() string

func (*MySQLStorage) SetVersions

func (msqlS *MySQLStorage) SetVersions(vrs Versions, overwrite bool) (err error)

SetVersions will set a slice of versions, updating existing

type PoolAllocation added in v0.11.0

type PoolAllocation struct {
	PoolID  string     // pool ID within the IPProfile
	Address netip.Addr // computed IP address
	Time    time.Time  // when this allocation was created
}

PoolAllocation represents one allocation in the pool.

func (*PoolAllocation) Clone added in v0.11.0

func (a *PoolAllocation) Clone() *PoolAllocation

Clone creates a deep copy of the PoolAllocation object.

type PostgresStorage

type PostgresStorage struct {
	SQLStorage
}

func (*PostgresStorage) GetStorageType

func (poS *PostgresStorage) GetStorageType() string

func (*PostgresStorage) SetVersions

func (poS *PostgresStorage) SetVersions(vrs Versions, overwrite bool) (err error)

type QOSRouteSorter added in v0.11.0

type QOSRouteSorter struct {
	// contains filtered or unexported fields
}

QOSSorter sorts route based on stats

func NewQOSRouteSorter added in v0.11.0

func NewQOSRouteSorter(rS *RouteService) *QOSRouteSorter

func (*QOSRouteSorter) SortRoutes added in v0.11.0

func (qos *QOSRouteSorter) SortRoutes(prflID string, routes map[string]*Route,
	ev *utils.CGREvent, extraOpts *optsGetRoutes) (sortedRoutes *SortedRoutes, err error)

type RGRate added in v0.11.0

type RGRate struct {
	GroupIntervalStart time.Duration
	Value              float64
	RateIncrement      time.Duration
	RateUnit           time.Duration
}

func (*RGRate) Clone added in v0.11.0

func (r *RGRate) Clone() (cln *RGRate)

Clone clones Rates

func (*RGRate) Equal added in v0.11.0

func (p *RGRate) Equal(o *RGRate) bool

func (*RGRate) FieldAsInterface added in v0.11.0

func (r *RGRate) FieldAsInterface(fldPath []string) (val any, err error)

FieldAsInterface func to help EventCost FieldAsInterface

func (*RGRate) Stringify added in v0.11.0

func (r *RGRate) Stringify() string

type RIRate

type RIRate struct {
	ConnectFee       float64
	RoundingMethod   string
	RoundingDecimals int
	MaxCost          float64
	MaxCostStrategy  string
	Rates            RateGroups // GroupRateInterval (start time): RGRate
	// contains filtered or unexported fields
}

Separate structure used for rating plan size optimization

func (*RIRate) Clone

func (rit *RIRate) Clone() (cln *RIRate)

Clone clones RIRate

func (*RIRate) Stringify

func (rir *RIRate) Stringify() string

type RITiming

type RITiming struct {
	ID        string
	Years     utils.Years
	Months    utils.Months
	MonthDays utils.MonthDays
	WeekDays  utils.WeekDays
	StartTime string // ##:##:## format
	EndTime   string // ##:##:## format
	// contains filtered or unexported fields
}

Separate structure used for rating plan size optimization

func (*RITiming) Clone

func (rit *RITiming) Clone() (cln *RITiming)

Clone clones RITiming

func (*RITiming) CronString

func (rit *RITiming) CronString() string

func (*RITiming) FieldAsInterface added in v0.11.0

func (rit *RITiming) FieldAsInterface(fldPath []string) (val any, err error)

func (*RITiming) FieldAsString added in v0.11.0

func (rit *RITiming) FieldAsString(fldPath []string) (val string, err error)

func (*RITiming) IsActive

func (rit *RITiming) IsActive() bool

IsActive returns wheter the Timing is active now

func (*RITiming) IsActiveAt

func (rit *RITiming) IsActiveAt(t time.Time) bool

Returns wheter the Timing is active at the specified time

func (*RITiming) IsBlank

func (rit *RITiming) IsBlank() bool

func (*RITiming) Stringify

func (rit *RITiming) Stringify() string

type RPCClientSet

type RPCClientSet map[string]*rpcclient.RPCClient

RPCClientSet is a RPC ClientConnector for the internal subsystems

var IntRPC RPCClientSet

IntRPC is the global variable that is used to comunicate with all the subsystems internally

func NewRPCClientSet

func NewRPCClientSet() (s RPCClientSet)

NewRPCClientSet initilalizates the map of connections

func (RPCClientSet) AddInternalRPCClient

func (s RPCClientSet) AddInternalRPCClient(name string, connChan chan birpc.ClientConnector)

AddInternalRPCClient creates and adds to the set a new rpc client using the provided configuration

func (RPCClientSet) Call

func (s RPCClientSet) Call(ctx *context.Context, method string, args any, reply any) error

Call the implementation of the birpc.ClientConnector interface

func (RPCClientSet) GetInternalChanel

func (s RPCClientSet) GetInternalChanel() chan birpc.ClientConnector

GetInternalChanel is used when RPCClientSet is passed as internal connection for RPCPool

type RPCRequest

type RPCRequest struct {
	Address   string
	Transport string
	Method    string
	Attempts  int
	Async     bool
	Params    map[string]any
}

RPCRequest used by rpc action

type RPRate

type RPRate struct {
	Timing string
	Rating string
	Weight float64
}

func (*RPRate) Clone added in v0.11.0

func (rpr *RPRate) Clone() *RPRate

Clone returns a clone of RPRate

func (*RPRate) Equal

func (rpr *RPRate) Equal(orpr *RPRate) bool

type RPRateList

type RPRateList []*RPRate

func (RPRateList) Clone added in v0.11.0

func (rprl RPRateList) Clone() RPRateList

Clone returns a clone of RPRateList

type RandomBalancesSorter

type RandomBalancesSorter []*Balance

func (*RandomBalancesSorter) Sort

func (rbcs *RandomBalancesSorter) Sort()

type Ranking added in v0.11.0

type Ranking struct {
	Tenant            string
	ID                string
	LastUpdate        time.Time
	Metrics           map[string]map[string]float64 // map[statID]map[metricID]metricValue
	Sorting           string
	SortingParameters []string

	SortedStatIDs []string
	// contains filtered or unexported fields
}

Ranking is one unit out of a profile

func NewRankingFromProfile added in v0.11.0

func NewRankingFromProfile(rkP *RankingProfile) (rk *Ranking)

NewRankingFromProfile is a constructor for an empty ranking out of it's profile

func (*Ranking) CacheClone added in v0.11.0

func (r *Ranking) CacheClone() any

CacheClone returns a clone of Ranking used by ltcache CacheCloner

func (*Ranking) Clone added in v0.11.0

func (r *Ranking) Clone() *Ranking

Clone clones *Ranking

func (*Ranking) TenantID added in v0.11.0

func (r *Ranking) TenantID() string

type RankingProfile added in v0.11.0

type RankingProfile struct {
	Tenant            string   // Tenant this profile belongs to
	ID                string   // Profile identification
	Schedule          string   // Cron schedule this profile should run at
	StatIDs           []string // List of stat instances to query
	MetricIDs         []string // Filter out only specific metrics in reply for sorting
	Sorting           string   // Sorting strategy. Possible values: <*asc|*desc>
	SortingParameters []string // Sorting parameters: depending on sorting type, list of metric ids for now with optional true or false in case of reverse logic is desired
	Stored            bool     // Offline storage activation for this profile
	ThresholdIDs      []string // List of threshold IDs to limit this Ranking to. *none to disable threshold processing for it.
}

RankingProfile represents one profile querying StatS and sorting them.

func APItoRanking added in v0.11.0

func APItoRanking(tpRG *utils.TPRankingProfile) (rg *RankingProfile, err error)

func (*RankingProfile) CacheClone added in v0.11.0

func (rkP *RankingProfile) CacheClone() any

CacheClone returns a clone of RankingProfile used by ltcache CacheCloner

func (*RankingProfile) Clone added in v0.11.0

func (rkP *RankingProfile) Clone() (cln *RankingProfile)

Clone will clone a RankingProfile

func (*RankingProfile) TenantID added in v0.11.0

func (rkp *RankingProfile) TenantID() string

type RankingProfileWithAPIOpts added in v0.11.0

type RankingProfileWithAPIOpts struct {
	*RankingProfile
	APIOpts map[string]any
}

type RankingS added in v0.11.0

type RankingS struct {
	// contains filtered or unexported fields
}

RankingS is responsible of implementing the logic of RankingService

func NewRankingS added in v0.11.0

func NewRankingS(dm *DataManager,
	connMgr *ConnManager,
	filterS *FilterS,
	cgrcfg *config.CGRConfig) *RankingS

NewRankingS is the constructor for RankingS

func (*RankingS) Reload added in v0.11.0

func (rkS *RankingS) Reload()

func (*RankingS) StartRankingS added in v0.11.0

func (rkS *RankingS) StartRankingS() (err error)

StartRankings will activates the Cron, together with all scheduled Ranking queries

func (*RankingS) StopRankingS added in v0.11.0

func (rkS *RankingS) StopRankingS()

StopCron will shutdown the Cron tasks

func (*RankingS) V1GetRanking added in v0.11.0

func (rkS *RankingS) V1GetRanking(ctx *context.Context, arg *utils.TenantIDWithAPIOpts, retRanking *Ranking) (err error)

V1GetRanking is the API to return the Ranking instance

func (*RankingS) V1GetRankingSummary added in v0.11.0

func (rS *RankingS) V1GetRankingSummary(ctx *context.Context, arg *utils.TenantIDWithAPIOpts, reply *RankingSummary) (err error)

V1GetRankingSummary returns a summary of ascending/descending stat of the last updated ranking

func (*RankingS) V1GetSchedule added in v0.11.0

func (rkS *RankingS) V1GetSchedule(ctx *context.Context, args *utils.ArgScheduledRankings, schedRankings *[]utils.ScheduledRanking) (err error)

V1GetSchedule returns the active schedule for Raking queries

func (*RankingS) V1ScheduleQueries added in v0.11.0

func (rkS *RankingS) V1ScheduleQueries(ctx *context.Context, args *utils.ArgScheduleRankingQueries, scheduled *int) (err error)

V1ScheduleQueries is the query for manually re-/scheduling Ranking Queries

type RankingSummary added in v0.11.0

type RankingSummary struct {
	Tenant        string
	ID            string
	LastUpdate    time.Time
	SortedStatIDs []string
}

RankingSummary is the event sent to TrendS and EEs

type RankingWithAPIOpts added in v0.11.0

type RankingWithAPIOpts struct {
	*Ranking
	APIOpts map[string]any
}

type RankingsMdl added in v0.11.0

type RankingsMdl struct {
	PK                uint `gorm:"primary_key"`
	Tpid              string
	Tenant            string `index:"0" re:".*"`
	ID                string `index:"1" re:".*"`
	Schedule          string `index:"2" re:".*"`
	StatIDs           string `index:"3" re:".*"`
	MetricIDs         string `index:"4" re:".*"`
	Sorting           string `index:"5" re:".*"`
	SortingParameters string `index:"6" re:".*"`
	Stored            bool   `index:"7" re:".*"`
	ThresholdIDs      string `index:"8" re:".*"`
	CreatedAt         time.Time
}

func (RankingsMdl) TableName added in v0.11.0

func (RankingsMdl) TableName() string

type RankingsMdls added in v0.11.0

type RankingsMdls []*RankingsMdl

func APItoModelTPRanking added in v0.11.0

func APItoModelTPRanking(tpRG *utils.TPRankingProfile) (mdls RankingsMdls)

func (RankingsMdls) AsTPRanking added in v0.11.0

func (models RankingsMdls) AsTPRanking() (result []*utils.TPRankingProfile)

func (RankingsMdls) CSVHeader added in v0.11.0

func (tps RankingsMdls) CSVHeader() (result []string)

type RateGroups

type RateGroups []*RGRate

func (*RateGroups) AddRate

func (pg *RateGroups) AddRate(ps ...*RGRate)

func (RateGroups) Clone

func (pg RateGroups) Clone() (cln RateGroups)

func (RateGroups) Equal

func (pg RateGroups) Equal(og RateGroups) bool

func (RateGroups) Equals

func (pg RateGroups) Equals(oRG RateGroups) bool

func (RateGroups) Len

func (pg RateGroups) Len() int

func (RateGroups) Less

func (pg RateGroups) Less(i, j int) bool

func (RateGroups) Sort

func (pg RateGroups) Sort()

func (RateGroups) Swap

func (pg RateGroups) Swap(i, j int)

type RateInterval

type RateInterval struct {
	Timing *RITiming
	Rating *RIRate
	Weight float64
}

Defines a time interval for which a certain set of prices will apply

func GetRateInterval

func GetRateInterval(rpl *utils.TPRatingPlanBinding, dr *utils.DestinationRate) (i *RateInterval)

func (*RateInterval) Clone

func (i *RateInterval) Clone() (cln *RateInterval)

Clone clones RateInterval

func (*RateInterval) Contains

func (i *RateInterval) Contains(t time.Time, endTime bool) bool

Returns true if the received time result inside the interval

func (*RateInterval) Equal

func (i *RateInterval) Equal(o *RateInterval) bool

func (*RateInterval) GetCost

func (i *RateInterval) GetCost(duration, startSecond time.Duration) float64

func (*RateInterval) GetMaxCost

func (ri *RateInterval) GetMaxCost() (float64, string)

func (*RateInterval) GetRateParameters

func (i *RateInterval) GetRateParameters(startSecond time.Duration) (rate float64, rateIncrement, rateUnit time.Duration)

Gets the price for a the provided start second

func (*RateInterval) String_DISABLED

func (i *RateInterval) String_DISABLED() string

type RateIntervalList

type RateIntervalList []*RateInterval

Structure to store intervals according to weight

func (RateIntervalList) GetWeight

func (rl RateIntervalList) GetWeight() float64

type RateIntervalTimeSorter

type RateIntervalTimeSorter struct {
	// contains filtered or unexported fields
}

Structure to store intervals according to weight

func (*RateIntervalTimeSorter) Len

func (il *RateIntervalTimeSorter) Len() int

func (*RateIntervalTimeSorter) Less

func (il *RateIntervalTimeSorter) Less(j, i int) bool

we need higher weights earlyer in the list

func (*RateIntervalTimeSorter) Sort

func (il *RateIntervalTimeSorter) Sort() []*RateInterval

func (*RateIntervalTimeSorter) Swap

func (il *RateIntervalTimeSorter) Swap(i, j int)

type RateMdl added in v0.11.0

type RateMdl struct {
	Id                 int64
	Tpid               string
	Tag                string  `index:"0" re:".*"`
	ConnectFee         float64 `index:"1" re:".*"`
	Rate               float64 `index:"2" re:".*"`
	RateUnit           string  `index:"3" re:".*"`
	RateIncrement      string  `index:"4" re:".*"`
	GroupIntervalStart string  `index:"5" re:".*"`
	CreatedAt          time.Time
}

func (RateMdl) TableName added in v0.11.0

func (RateMdl) TableName() string

type RateMdls added in v0.11.0

type RateMdls []RateMdl

func APItoModelRate

func APItoModelRate(r *utils.TPRateRALs) (result RateMdls)

func APItoModelRates

func APItoModelRates(rs []*utils.TPRateRALs) (result RateMdls)

func (RateMdls) AsMapRates added in v0.11.0

func (tps RateMdls) AsMapRates() (map[string]*utils.TPRateRALs, error)

func (RateMdls) AsTPRates added in v0.11.0

func (tps RateMdls) AsTPRates() (result []*utils.TPRateRALs, err error)

type Rating

type Rating map[string]*RatingUnit

Rating the map of rating units

func (Rating) Clone

func (crus Rating) Clone() (cln Rating)

Clone creates a copy of Rating

func (Rating) FieldAsInterface

func (crus Rating) FieldAsInterface(fldPath []string) (val any, err error)

FieldAsInterface func to help EventCost FieldAsInterface

func (Rating) GetIDWithSet

func (crus Rating) GetIDWithSet(cru *RatingUnit) string

GetIDWithSet attempts to retrieve the UUID of a matching data or create a new one

type RatingFilters

type RatingFilters map[string]RatingMatchedFilters // so we can define search methods

RatingFilters the map of rating filters

func (RatingFilters) Clone

func (rfs RatingFilters) Clone() (cln RatingFilters)

Clone creates a copy of RatingFilters

func (RatingFilters) FieldAsInterface

func (rfs RatingFilters) FieldAsInterface(fldPath []string) (val any, err error)

FieldAsInterface func to help EventCost FieldAsInterface

func (RatingFilters) GetIDWithSet

func (rfs RatingFilters) GetIDWithSet(rmf RatingMatchedFilters) string

GetIDWithSet attempts to retrieve the UUID of a matching data or create a new one

type RatingInfo

type RatingInfo struct {
	MatchedSubject string
	RatingPlanId   string
	MatchedPrefix  string
	MatchedDestId  string
	ActivationTime time.Time
	RateIntervals  RateIntervalList
	FallbackKeys   []string
}

func (RatingInfo) SelectRatingIntevalsForTimespan

func (ri RatingInfo) SelectRatingIntevalsForTimespan(ts *TimeSpan) (result RateIntervalList)

SelectRatingIntevalsForTimespan orders rate intervals in time preserving only those which aply to the specified timestamp

type RatingInfos

type RatingInfos []*RatingInfo

func (RatingInfos) Len

func (ris RatingInfos) Len() int

func (RatingInfos) Less

func (ris RatingInfos) Less(i, j int) bool

func (RatingInfos) Sort

func (ris RatingInfos) Sort()

func (RatingInfos) String

func (ris RatingInfos) String() string

func (RatingInfos) Swap

func (ris RatingInfos) Swap(i, j int)

type RatingMatchedFilters

type RatingMatchedFilters map[string]any

RatingMatchedFilters a rating filter

func (RatingMatchedFilters) Clone

func (rf RatingMatchedFilters) Clone() (cln map[string]any)

Clone creates a copy of RatingMatchedFilters

func (RatingMatchedFilters) Equals

Equals returns if the RatingMatchedFilters are equal

func (RatingMatchedFilters) FieldAsInterface

func (rf RatingMatchedFilters) FieldAsInterface(fldPath []string) (val any, err error)

FieldAsInterface func to help EventCost FieldAsInterface

type RatingPlan

type RatingPlan struct {
	Id               string
	Timings          map[string]*RITiming
	Ratings          map[string]*RIRate
	DestinationRates map[string]RPRateList
}

The struture that is saved to storage.

func (*RatingPlan) AddRateInterval

func (rp *RatingPlan) AddRateInterval(dId string, ris ...*RateInterval)

Adds one ore more intervals to the internal interval list only if it is not allready in the list.

func (*RatingPlan) CacheClone added in v0.11.0

func (rp *RatingPlan) CacheClone() any

CacheClone returns a clone of RatingPlan used by ltcache CacheCloner

func (*RatingPlan) Clone added in v0.11.0

func (rp *RatingPlan) Clone() *RatingPlan

Clone returns a clone of RatingPlan

func (*RatingPlan) Equal

func (rp *RatingPlan) Equal(o *RatingPlan) bool

func (*RatingPlan) RateIntervalList

func (rp *RatingPlan) RateIntervalList(dId string) RateIntervalList

type RatingPlanActivation

type RatingPlanActivation struct {
	ActivationTime time.Time
	RatingPlanId   string
	FallbackKeys   []string
}

func (*RatingPlanActivation) Clone added in v0.11.0

Clone returns a clone of RatingPlanActivation

func (*RatingPlanActivation) Equal

type RatingPlanActivations

type RatingPlanActivations []*RatingPlanActivation

func (RatingPlanActivations) Clone added in v0.11.0

Clone returns a clone of RatingPlanActivations

func (RatingPlanActivations) GetActiveForCall

func (rpas RatingPlanActivations) GetActiveForCall(cd *CallDescriptor) RatingPlanActivations

func (RatingPlanActivations) Len

func (rpas RatingPlanActivations) Len() int

func (RatingPlanActivations) Less

func (rpas RatingPlanActivations) Less(i, j int) bool

func (RatingPlanActivations) Sort

func (rpas RatingPlanActivations) Sort()

func (RatingPlanActivations) Swap

func (rpas RatingPlanActivations) Swap(i, j int)

type RatingPlanMdl added in v0.11.0

type RatingPlanMdl struct {
	Id           int64
	Tpid         string
	Tag          string  `index:"0" re:".*"`
	DestratesTag string  `index:"1" re:".*"`
	TimingTag    string  `index:"2" re:".*"`
	Weight       float64 `index:"3" re:".*"`
	CreatedAt    time.Time
}

func (RatingPlanMdl) TableName added in v0.11.0

func (RatingPlanMdl) TableName() string

type RatingPlanMdls added in v0.11.0

type RatingPlanMdls []RatingPlanMdl

func APItoModelRatingPlan

func APItoModelRatingPlan(rp *utils.TPRatingPlan) (result RatingPlanMdls)

func APItoModelRatingPlans

func APItoModelRatingPlans(rps []*utils.TPRatingPlan) (result RatingPlanMdls)

func (RatingPlanMdls) AsMapTPRatingPlans added in v0.11.0

func (tps RatingPlanMdls) AsMapTPRatingPlans() (result map[string]*utils.TPRatingPlan)

func (RatingPlanMdls) AsTPRatingPlans added in v0.11.0

func (tps RatingPlanMdls) AsTPRatingPlans() (result []*utils.TPRatingPlan)

type RatingPlanWithAPIOpts added in v0.11.0

type RatingPlanWithAPIOpts struct {
	*RatingPlan
	Tenant  string
	APIOpts map[string]any
}

RatingPlanWithOpts is used in replicatorV1 for dispatcher

type RatingProfile

type RatingProfile struct {
	Id                    string
	RatingPlanActivations RatingPlanActivations
}

func RatingProfileSubjectPrefixMatching

func RatingProfileSubjectPrefixMatching(key string) (rp *RatingProfile, err error)

func (*RatingProfile) CacheClone added in v0.11.0

func (rp *RatingProfile) CacheClone() any

CacheClone returns a clone of RatingProfile used by ltcache CacheCloner

func (*RatingProfile) Clone added in v0.11.0

func (rp *RatingProfile) Clone() *RatingProfile

Clone returns a clone of RatingProfile

func (*RatingProfile) GetRatingPlansForPrefix

func (rpf *RatingProfile) GetRatingPlansForPrefix(cd *CallDescriptor) (err error)

type RatingProfileMdl added in v0.11.0

type RatingProfileMdl struct {
	Id               int64
	Tpid             string
	Loadid           string
	Tenant           string `index:"0" re:".*"`
	Category         string `index:"1" re:".*"`
	Subject          string `index:"2" re:".*"`
	ActivationTime   string `index:"3" re:".*"`
	RatingPlanTag    string `index:"4" re:".*"`
	FallbackSubjects string `index:"5" re:".*"`
	CreatedAt        time.Time
}

func (RatingProfileMdl) TableName added in v0.11.0

func (RatingProfileMdl) TableName() string

type RatingProfileMdls added in v0.11.0

type RatingProfileMdls []RatingProfileMdl

func APItoModelRatingProfile

func APItoModelRatingProfile(rp *utils.TPRatingProfile) (result RatingProfileMdls)

func APItoModelRatingProfiles

func APItoModelRatingProfiles(rps []*utils.TPRatingProfile) (result RatingProfileMdls)

func (RatingProfileMdls) AsMapTPRatingProfiles added in v0.11.0

func (tps RatingProfileMdls) AsMapTPRatingProfiles() (result map[string]*utils.TPRatingProfile)

func (RatingProfileMdls) AsTPRatingProfiles added in v0.11.0

func (tps RatingProfileMdls) AsTPRatingProfiles() (result []*utils.TPRatingProfile)

type RatingProfileWithAPIOpts added in v0.11.0

type RatingProfileWithAPIOpts struct {
	*RatingProfile
	Tenant  string
	APIOpts map[string]any
}

RatingProfileWithAPIOpts is used in replicatorV1 for dispatcher

type RatingUnit

type RatingUnit struct {
	ConnectFee       float64
	RoundingMethod   string
	RoundingDecimals int
	MaxCost          float64
	MaxCostStrategy  string
	TimingID         string // This RatingUnit is bounded to specific timing profile
	RatesID          string
	RatingFiltersID  string
}

RatingUnit represents one unit out of RatingPlan matching for an event

func (*RatingUnit) Clone

func (ru *RatingUnit) Clone() (cln *RatingUnit)

Clone creates a copy of RatingUnit

func (*RatingUnit) Equals

func (ru *RatingUnit) Equals(oRU *RatingUnit) bool

Equals returns if RatingUnit is equal to the other

func (RatingUnit) FieldAsInterface

func (ru RatingUnit) FieldAsInterface(fldPath []string) (val any, err error)

FieldAsInterface func to help EventCost FieldAsInterface

type RedisStorage

type RedisStorage struct {
	// contains filtered or unexported fields
}

func NewRedisStorage

func NewRedisStorage(address string, db int, user, pass, mrshlerStr string,
	maxConns, retryAttempts int, sentinelName string, isCluster bool, clusterSync,
	clusterOnDownDelay, connTimeout, pipelineWindow time.Duration, pipelineLimit int,
	tlsConn bool, tlsClientCert, tlsClientKey, tlsCACert string) (_ *RedisStorage, err error)

func (*RedisStorage) AddLoadHistory

func (rs *RedisStorage) AddLoadHistory(ldInst *utils.LoadInstance, loadHistSize int, transactionID string) (err error)

Adds a single load instance to load history

func (*RedisStorage) BackupDataDB added in v0.11.0

func (rs *RedisStorage) BackupDataDB(backupFolderPath string, zip bool) (err error)

BackupDataDB will momentarely stop any dumping and rewriting until all dump folder is backed up in folder path backupFolderPath, making zip true will create a zip file in the path instead, only for InternalDB

func (*RedisStorage) Close

func (rs *RedisStorage) Close()

func (*RedisStorage) Cmd

func (rs *RedisStorage) Cmd(rcv any, cmd string, args ...string) error

Cmd executes a Redis command with the given receiver for the result.

func (*RedisStorage) DumpDataDB added in v0.11.0

func (rs *RedisStorage) DumpDataDB() error

DumpDataDB will dump all of datadb from memory to a file, only for InternalDB

func (*RedisStorage) FlatCmd added in v0.11.0

func (rs *RedisStorage) FlatCmd(rcv any, cmd, key string, args ...any) error

FlatCmd executes a Redis command with flat key-value arguments, optimized for hash operations

func (*RedisStorage) Flush

func (rs *RedisStorage) Flush(ignore string) error

func (*RedisStorage) GetAccountActionPlansDrv

func (rs *RedisStorage) GetAccountActionPlansDrv(acntID string) (aPlIDs []string, err error)

func (*RedisStorage) GetAccountDrv

func (rs *RedisStorage) GetAccountDrv(key string) (ub *Account, err error)

func (*RedisStorage) GetActionPlanDrv

func (rs *RedisStorage) GetActionPlanDrv(key string) (ats *ActionPlan, err error)

func (*RedisStorage) GetActionTriggersDrv

func (rs *RedisStorage) GetActionTriggersDrv(key string) (atrs ActionTriggers, err error)

func (*RedisStorage) GetActionsDrv

func (rs *RedisStorage) GetActionsDrv(key string) (as Actions, err error)

func (*RedisStorage) GetAllActionPlansDrv

func (rs *RedisStorage) GetAllActionPlansDrv() (ats map[string]*ActionPlan, err error)

func (*RedisStorage) GetAttributeProfileDrv

func (rs *RedisStorage) GetAttributeProfileDrv(tenant, id string) (r *AttributeProfile, err error)

func (*RedisStorage) GetChargerProfileDrv

func (rs *RedisStorage) GetChargerProfileDrv(tenant, id string) (r *ChargerProfile, err error)

func (*RedisStorage) GetDestinationDrv

func (rs *RedisStorage) GetDestinationDrv(key, transactionID string) (dest *Destination, err error)

GetDestination retrieves a destination with id from tp_db

func (*RedisStorage) GetDispatcherHostDrv

func (rs *RedisStorage) GetDispatcherHostDrv(tenant, id string) (r *DispatcherHost, err error)

func (*RedisStorage) GetDispatcherProfileDrv

func (rs *RedisStorage) GetDispatcherProfileDrv(tenant, id string) (r *DispatcherProfile, err error)

func (*RedisStorage) GetFilterDrv

func (rs *RedisStorage) GetFilterDrv(tenant, id string) (r *Filter, err error)

func (*RedisStorage) GetIPAllocationsDrv added in v0.11.0

func (rs *RedisStorage) GetIPAllocationsDrv(tenant, id string) (*IPAllocations, error)

func (*RedisStorage) GetIPProfileDrv added in v0.11.0

func (rs *RedisStorage) GetIPProfileDrv(tenant, id string) (*IPProfile, error)

func (*RedisStorage) GetIndexesDrv added in v0.11.0

func (rs *RedisStorage) GetIndexesDrv(idxItmType, tntCtx string, idxKeys ...string) (indexes map[string]utils.StringSet, err error)

GetIndexesDrv retrieves Indexes from dataDB

func (*RedisStorage) GetItemLoadIDsDrv

func (rs *RedisStorage) GetItemLoadIDsDrv(itemIDPrefix string) (loadIDs map[string]int64, err error)

func (*RedisStorage) GetKeysForPrefix

func (rs *RedisStorage) GetKeysForPrefix(prefix, search string) ([]string, error)

GetKeysForPrefix returns the keys from redis that have the given prefix. If search is populated it will also match the string given in search parameter

func (*RedisStorage) GetLoadHistory

func (rs *RedisStorage) GetLoadHistory(limit int, skipCache bool,
	transactionID string) (loadInsts []*utils.LoadInstance, err error)

Limit will only retrieve the last n items out of history, newest first

func (*RedisStorage) GetRankingDrv added in v0.11.0

func (rs *RedisStorage) GetRankingDrv(tenant, id string) (rn *Ranking, err error)

func (*RedisStorage) GetRankingProfileDrv added in v0.11.0

func (rs *RedisStorage) GetRankingProfileDrv(tenant string, id string) (sg *RankingProfile, err error)

func (*RedisStorage) GetRatingPlanDrv

func (rs *RedisStorage) GetRatingPlanDrv(key string) (rp *RatingPlan, err error)

func (*RedisStorage) GetRatingProfileDrv

func (rs *RedisStorage) GetRatingProfileDrv(key string) (rpf *RatingProfile, err error)

func (*RedisStorage) GetResourceDrv

func (rs *RedisStorage) GetResourceDrv(tenant, id string) (r *Resource, err error)

func (*RedisStorage) GetResourceProfileDrv

func (rs *RedisStorage) GetResourceProfileDrv(tenant, id string) (rsp *ResourceProfile, err error)

func (*RedisStorage) GetReverseDestinationDrv

func (rs *RedisStorage) GetReverseDestinationDrv(key, transactionID string) (ids []string, err error)

func (*RedisStorage) GetRouteProfileDrv added in v0.11.0

func (rs *RedisStorage) GetRouteProfileDrv(tenant, id string) (r *RouteProfile, err error)

func (*RedisStorage) GetSessionsBackupDrv added in v0.11.0

func (rs *RedisStorage) GetSessionsBackupDrv(nodeID, tnt string) (r []*StoredSession, err error)

Will restore sessions that were active from dataDB backup

func (*RedisStorage) GetSharedGroupDrv

func (rs *RedisStorage) GetSharedGroupDrv(key string) (sg *SharedGroup, err error)

func (*RedisStorage) GetStatQueueDrv

func (rs *RedisStorage) GetStatQueueDrv(tenant, id string) (sq *StatQueue, err error)

GetStatQueueDrv retrieves the stored metrics for a StatsQueue

func (*RedisStorage) GetStatQueueProfileDrv

func (rs *RedisStorage) GetStatQueueProfileDrv(tenant string, id string) (sq *StatQueueProfile, err error)

GetStatQueueProfileDrv retrieves a StatQueueProfile from dataDB

func (*RedisStorage) GetStorageType

func (rs *RedisStorage) GetStorageType() string

func (*RedisStorage) GetThresholdDrv

func (rs *RedisStorage) GetThresholdDrv(tenant, id string) (r *Threshold, err error)

func (*RedisStorage) GetThresholdProfileDrv

func (rs *RedisStorage) GetThresholdProfileDrv(tenant, ID string) (tp *ThresholdProfile, err error)

GetThresholdProfileDrv retrieves a ThresholdProfile from dataDB

func (*RedisStorage) GetTimingDrv

func (rs *RedisStorage) GetTimingDrv(id string) (t *utils.TPTiming, err error)

func (*RedisStorage) GetTrendDrv added in v0.11.0

func (rs *RedisStorage) GetTrendDrv(tenant, id string) (tr *Trend, err error)

func (*RedisStorage) GetTrendProfileDrv added in v0.11.0

func (rs *RedisStorage) GetTrendProfileDrv(tenant string, id string) (sg *TrendProfile, err error)

func (*RedisStorage) GetVersions

func (rs *RedisStorage) GetVersions(itm string) (vrs Versions, err error)

func (*RedisStorage) HasDataDrv

func (rs *RedisStorage) HasDataDrv(category, subject, tenant string) (exists bool, err error)

Used to check if specific subject is stored using prefix key attached to entity

func (*RedisStorage) IsDBEmpty

func (rs *RedisStorage) IsDBEmpty() (resp bool, err error)

func (*RedisStorage) Marshaler

func (rs *RedisStorage) Marshaler() Marshaler

func (*RedisStorage) PopTask

func (rs *RedisStorage) PopTask() (t *Task, err error)

func (*RedisStorage) PushTask

func (rs *RedisStorage) PushTask(t *Task) (err error)

func (*RedisStorage) RebbuildActionPlanKeys

func (rs *RedisStorage) RebbuildActionPlanKeys() (err error)

func (*RedisStorage) RemAccountActionPlansDrv

func (rs *RedisStorage) RemAccountActionPlansDrv(acntID string) (err error)

func (*RedisStorage) RemRankingProfileDrv added in v0.11.0

func (rs *RedisStorage) RemRankingProfileDrv(tenant string, id string) (err error)

func (*RedisStorage) RemStatQueueDrv

func (rs *RedisStorage) RemStatQueueDrv(tenant, id string) (err error)

RemStatQueueDrv removes a StatsQueue

func (*RedisStorage) RemStatQueueProfileDrv

func (rs *RedisStorage) RemStatQueueProfileDrv(tenant, id string) (err error)

RemStatQueueProfileDrv removes a StatsQueue from dataDB

func (*RedisStorage) RemThresholdProfileDrv

func (rs *RedisStorage) RemThresholdProfileDrv(tenant, id string) (err error)

RemThresholdProfileDrv removes a ThresholdProfile from dataDB/cache

func (*RedisStorage) RemTrendProfileDrv added in v0.11.0

func (rs *RedisStorage) RemTrendProfileDrv(tenant string, id string) (err error)

func (*RedisStorage) RemoveAccountDrv

func (rs *RedisStorage) RemoveAccountDrv(key string) (err error)

func (*RedisStorage) RemoveActionPlanDrv

func (rs *RedisStorage) RemoveActionPlanDrv(key string) (err error)

func (*RedisStorage) RemoveActionTriggersDrv

func (rs *RedisStorage) RemoveActionTriggersDrv(key string) (err error)

func (*RedisStorage) RemoveActionsDrv

func (rs *RedisStorage) RemoveActionsDrv(key string) (err error)

func (*RedisStorage) RemoveAttributeProfileDrv

func (rs *RedisStorage) RemoveAttributeProfileDrv(tenant, id string) (err error)

func (*RedisStorage) RemoveChargerProfileDrv

func (rs *RedisStorage) RemoveChargerProfileDrv(tenant, id string) (err error)

func (*RedisStorage) RemoveDestinationDrv

func (rs *RedisStorage) RemoveDestinationDrv(destID, transactionID string) (err error)

func (*RedisStorage) RemoveDispatcherHostDrv

func (rs *RedisStorage) RemoveDispatcherHostDrv(tenant, id string) (err error)

func (*RedisStorage) RemoveDispatcherProfileDrv

func (rs *RedisStorage) RemoveDispatcherProfileDrv(tenant, id string) (err error)

func (*RedisStorage) RemoveFilterDrv

func (rs *RedisStorage) RemoveFilterDrv(tenant, id string) (err error)

func (*RedisStorage) RemoveIPAllocationsDrv added in v0.11.0

func (rs *RedisStorage) RemoveIPAllocationsDrv(tenant, id string) error

func (*RedisStorage) RemoveIPProfileDrv added in v0.11.0

func (rs *RedisStorage) RemoveIPProfileDrv(tenant, id string) error

func (*RedisStorage) RemoveIndexesDrv added in v0.11.0

func (rs *RedisStorage) RemoveIndexesDrv(idxItmType, tntCtx string, idxKeys ...string) (err error)

func (*RedisStorage) RemoveKeysForPrefix added in v0.10.3

func (rs *RedisStorage) RemoveKeysForPrefix(prefix string) (err error)

func (*RedisStorage) RemoveLoadIDsDrv

func (rs *RedisStorage) RemoveLoadIDsDrv() (err error)

func (*RedisStorage) RemoveRankingDrv added in v0.11.0

func (rs *RedisStorage) RemoveRankingDrv(tenant, id string) (err error)

func (*RedisStorage) RemoveRatingPlanDrv

func (rs *RedisStorage) RemoveRatingPlanDrv(key string) (err error)

func (*RedisStorage) RemoveRatingProfileDrv

func (rs *RedisStorage) RemoveRatingProfileDrv(key string) (err error)

func (*RedisStorage) RemoveResourceDrv

func (rs *RedisStorage) RemoveResourceDrv(tenant, id string) (err error)

func (*RedisStorage) RemoveResourceProfileDrv

func (rs *RedisStorage) RemoveResourceProfileDrv(tenant, id string) (err error)

func (*RedisStorage) RemoveReverseDestinationDrv added in v0.11.0

func (rs *RedisStorage) RemoveReverseDestinationDrv(dstID, prfx, transactionID string) (err error)

func (*RedisStorage) RemoveRouteProfileDrv added in v0.11.0

func (rs *RedisStorage) RemoveRouteProfileDrv(tenant, id string) (err error)

func (*RedisStorage) RemoveSessionsBackupDrv added in v0.11.0

func (rs *RedisStorage) RemoveSessionsBackupDrv(nodeID, tnt, cgrid string) error

Will remove one or all sessions from dataDB backup

func (*RedisStorage) RemoveSharedGroupDrv

func (rs *RedisStorage) RemoveSharedGroupDrv(id string) (err error)

func (*RedisStorage) RemoveThresholdDrv

func (rs *RedisStorage) RemoveThresholdDrv(tenant, id string) (err error)

func (*RedisStorage) RemoveTimingDrv

func (rs *RedisStorage) RemoveTimingDrv(id string) (err error)

func (*RedisStorage) RemoveTrendDrv added in v0.11.0

func (rs *RedisStorage) RemoveTrendDrv(tenant, id string) (err error)

func (*RedisStorage) RemoveVersions

func (rs *RedisStorage) RemoveVersions(vrs Versions) (err error)

func (*RedisStorage) RestoreDataDB added in v0.11.0

func (rs *RedisStorage) RestoreDataDB(backupFolderPath string) (err error)

RestoreDataDB, only for InternalDB

func (*RedisStorage) RewriteDataDB added in v0.11.0

func (rs *RedisStorage) RewriteDataDB() (err error)

Will rewrite every dump file of DataDB, only for InternalDB

func (*RedisStorage) SetAccountActionPlansDrv

func (rs *RedisStorage) SetAccountActionPlansDrv(acntID string, aPlIDs []string) (err error)

func (*RedisStorage) SetAccountDrv

func (rs *RedisStorage) SetAccountDrv(acc *Account) (err error)

func (*RedisStorage) SetActionPlanDrv

func (rs *RedisStorage) SetActionPlanDrv(key string, ats *ActionPlan) (err error)

func (*RedisStorage) SetActionTriggersDrv

func (rs *RedisStorage) SetActionTriggersDrv(key string, atrs ActionTriggers) (err error)

func (*RedisStorage) SetActionsDrv

func (rs *RedisStorage) SetActionsDrv(key string, as Actions) (err error)

func (*RedisStorage) SetAttributeProfileDrv

func (rs *RedisStorage) SetAttributeProfileDrv(r *AttributeProfile) (err error)

func (*RedisStorage) SetBackupSessionsDrv added in v0.11.0

func (rs *RedisStorage) SetBackupSessionsDrv(nodeID string,
	tnt string, storedSessions []*StoredSession) (err error)

Will backup active sessions in DataDB

func (*RedisStorage) SetChargerProfileDrv

func (rs *RedisStorage) SetChargerProfileDrv(r *ChargerProfile) (err error)

func (*RedisStorage) SetDestinationDrv

func (rs *RedisStorage) SetDestinationDrv(dest *Destination, transactionID string) (err error)

func (*RedisStorage) SetDispatcherHostDrv

func (rs *RedisStorage) SetDispatcherHostDrv(r *DispatcherHost) (err error)

func (*RedisStorage) SetDispatcherProfileDrv

func (rs *RedisStorage) SetDispatcherProfileDrv(r *DispatcherProfile) (err error)

func (*RedisStorage) SetFilterDrv

func (rs *RedisStorage) SetFilterDrv(r *Filter) (err error)

func (*RedisStorage) SetIPAllocationsDrv added in v0.11.0

func (rs *RedisStorage) SetIPAllocationsDrv(ip *IPAllocations) error

func (*RedisStorage) SetIPProfileDrv added in v0.11.0

func (rs *RedisStorage) SetIPProfileDrv(ipp *IPProfile) error

func (*RedisStorage) SetIndexesDrv added in v0.11.0

func (rs *RedisStorage) SetIndexesDrv(idxItmType, tntCtx string,
	indexes map[string]utils.StringSet, commit bool, transactionID string) (err error)

SetIndexesDrv stores Indexes into DataDB

func (*RedisStorage) SetLoadIDsDrv

func (rs *RedisStorage) SetLoadIDsDrv(loadIDs map[string]int64) error

func (*RedisStorage) SetRankingDrv added in v0.11.0

func (rs *RedisStorage) SetRankingDrv(rn *Ranking) (err error)

func (*RedisStorage) SetRankingProfileDrv added in v0.11.0

func (rs *RedisStorage) SetRankingProfileDrv(sg *RankingProfile) (err error)

func (*RedisStorage) SetRatingPlanDrv

func (rs *RedisStorage) SetRatingPlanDrv(rp *RatingPlan) (err error)

func (*RedisStorage) SetRatingProfileDrv

func (rs *RedisStorage) SetRatingProfileDrv(rpf *RatingProfile) (err error)

func (*RedisStorage) SetResourceDrv

func (rs *RedisStorage) SetResourceDrv(r *Resource) (err error)

func (*RedisStorage) SetResourceProfileDrv

func (rs *RedisStorage) SetResourceProfileDrv(rsp *ResourceProfile) (err error)

func (*RedisStorage) SetReverseDestinationDrv

func (rs *RedisStorage) SetReverseDestinationDrv(destID string, prefixes []string, transactionID string) (err error)

func (*RedisStorage) SetRouteProfileDrv added in v0.11.0

func (rs *RedisStorage) SetRouteProfileDrv(r *RouteProfile) (err error)

func (*RedisStorage) SetSharedGroupDrv

func (rs *RedisStorage) SetSharedGroupDrv(sg *SharedGroup) (err error)

func (*RedisStorage) SetStatQueueDrv

func (rs *RedisStorage) SetStatQueueDrv(ssq *StoredStatQueue, sq *StatQueue) (err error)

SetStatQueueDrv stores the metrics for a StatsQueue

func (*RedisStorage) SetStatQueueProfileDrv

func (rs *RedisStorage) SetStatQueueProfileDrv(sq *StatQueueProfile) (err error)

SetStatQueueProfileDrv stores a StatsQueue into DataDB

func (*RedisStorage) SetThresholdDrv

func (rs *RedisStorage) SetThresholdDrv(r *Threshold) (err error)

func (*RedisStorage) SetThresholdProfileDrv

func (rs *RedisStorage) SetThresholdProfileDrv(tp *ThresholdProfile) (err error)

SetThresholdProfileDrv stores a ThresholdProfile into DataDB

func (*RedisStorage) SetTimingDrv

func (rs *RedisStorage) SetTimingDrv(t *utils.TPTiming) (err error)

func (*RedisStorage) SetTrendDrv added in v0.11.0

func (rs *RedisStorage) SetTrendDrv(r *Trend) (err error)

func (*RedisStorage) SetTrendProfileDrv added in v0.11.0

func (rs *RedisStorage) SetTrendProfileDrv(sg *TrendProfile) (err error)

func (*RedisStorage) SetVersions

func (rs *RedisStorage) SetVersions(vrs Versions, overwrite bool) (err error)

func (*RedisStorage) SnapshotDataDB added in v0.11.0

func (rs *RedisStorage) SnapshotDataDB(backupFolderPath string, zip bool) (err error)

SnapshotDataDB, only for InternalDB

type RemAccountActionPlansArgsWithAPIOpts added in v0.11.0

type RemAccountActionPlansArgsWithAPIOpts struct {
	AcntID  string
	ApIDs   []string
	Tenant  string
	APIOpts map[string]any
}

RemAccountActionPlansArgsWithAPIOpts is used in replicatorV1 for dispatcher

type RemoveSessionBackupArgs added in v0.11.0

type RemoveSessionBackupArgs struct {
	Tenant string // used as part of filter of DataDB query
	NodeID string // used as part of filter of DataDB query
	CGRID  string // used as part of filter of DataDB query
}

type ReplicationTask added in v0.11.0

type ReplicationTask struct {
	ConnIDs  []string
	Filtered bool
	Path     string
	ObjType  string
	ObjID    string
	Method   string
	Args     any
}

ReplicationTask represents a replication operation that can be saved to disk and executed later, typically used for failed replications.

func NewReplicationTaskFromFile added in v0.11.0

func NewReplicationTaskFromFile(path string) (*ReplicationTask, error)

NewReplicationTaskFromFile loads a replication task from the specified file. The file is removed after successful loading.

func (*ReplicationTask) Execute added in v0.11.0

func (r *ReplicationTask) Execute(cm *ConnManager) error

Execute performs the replication task.

func (*ReplicationTask) WriteToFile added in v0.11.0

func (r *ReplicationTask) WriteToFile(path string) error

WriteToFile saves the replication task to the specified path. This allows failed tasks to be recovered and retried later.

type Resource

type Resource struct {
	Tenant string
	ID     string
	Usages map[string]*ResourceUsage
	TTLIdx []string // holds ordered list of ResourceIDs based on their TTL, empty if feature is disableda
	// contains filtered or unexported fields
}

Resource represents a resource in the system not thread safe, needs locking at process level

func (*Resource) CacheClone added in v0.11.0

func (apl *Resource) CacheClone() any

CacheClone returns a clone of ActionPlan used by ltcache CacheCloner

func (*Resource) Clone added in v0.11.0

func (r *Resource) Clone() *Resource

Clone clones *Resource (lkID excluded)

func (*Resource) TenantID

func (r *Resource) TenantID() string

TenantID returns the unique ID in a multi-tenant environment

func (*Resource) TotalUsage

func (r *Resource) TotalUsage() (tU float64)

TotalUsage returns the sum of all usage units Exported to be used in FilterS

type ResourceAscendentSorter

type ResourceAscendentSorter struct {
	// contains filtered or unexported fields
}

ResourceAscendentSorter orders ascendent routes based on their Resource Usage

func NewResourceAscendetSorter

func NewResourceAscendetSorter(rS *RouteService) *ResourceAscendentSorter

func (*ResourceAscendentSorter) SortRoutes added in v0.11.0

func (ws *ResourceAscendentSorter) SortRoutes(prflID string,
	routes map[string]*Route, suplEv *utils.CGREvent, extraOpts *optsGetRoutes) (sortedRoutes *SortedRoutes, err error)

type ResourceDescendentSorter

type ResourceDescendentSorter struct {
	// contains filtered or unexported fields
}

ResourceDescendentSorter orders suppliers based on their Resource Usage

func NewResourceDescendentSorter

func NewResourceDescendentSorter(rS *RouteService) *ResourceDescendentSorter

func (*ResourceDescendentSorter) SortRoutes added in v0.11.0

func (ws *ResourceDescendentSorter) SortRoutes(prflID string,
	routes map[string]*Route, suplEv *utils.CGREvent, extraOpts *optsGetRoutes) (sortedRoutes *SortedRoutes, err error)

type ResourceMdl added in v0.11.0

type ResourceMdl struct {
	PK                 uint `gorm:"primary_key"`
	Tpid               string
	Tenant             string  `index:"0" re:".*"`
	ID                 string  `index:"1" re:".*"`
	FilterIDs          string  `index:"2" re:".*"`
	ActivationInterval string  `index:"3" re:".*"`
	UsageTTL           string  `index:"4" re:".*"`
	Limit              string  `index:"5" re:".*"`
	AllocationMessage  string  `index:"6" re:".*"`
	Blocker            bool    `index:"7" re:".*"`
	Stored             bool    `index:"8" re:".*"`
	Weight             float64 `index:"9" re:".*"`
	ThresholdIDs       string  `index:"10" re:".*"`
	CreatedAt          time.Time
}

func (ResourceMdl) TableName added in v0.11.0

func (ResourceMdl) TableName() string

type ResourceMdls added in v0.11.0

type ResourceMdls []*ResourceMdl

func APItoModelResource

func APItoModelResource(rl *utils.TPResourceProfile) (mdls ResourceMdls)

func (ResourceMdls) AsTPResources added in v0.11.0

func (tps ResourceMdls) AsTPResources() (result []*utils.TPResourceProfile)

func (ResourceMdls) CSVHeader added in v0.11.0

func (tps ResourceMdls) CSVHeader() (result []string)

CSVHeader return the header for csv fields as a slice of string

type ResourceProfile

type ResourceProfile struct {
	Tenant             string
	ID                 string // identifier of this resource
	FilterIDs          []string
	ActivationInterval *utils.ActivationInterval // time when this resource becomes active and expires
	UsageTTL           time.Duration             // auto-expire the usage after this duration
	Limit              float64                   // limit value
	AllocationMessage  string                    // message returned by the winning resource on allocation
	Blocker            bool                      // blocker flag to stop processing on filters matched
	Stored             bool
	Weight             float64  // Weight to sort the resources
	ThresholdIDs       []string // Thresholds to check after changing Limit
	// contains filtered or unexported fields
}

ResourceProfile represents the user configuration for the resource

func APItoResource

func APItoResource(tpRL *utils.TPResourceProfile, timezone string) (rp *ResourceProfile, err error)

func (*ResourceProfile) CacheClone added in v0.11.0

func (rp *ResourceProfile) CacheClone() any

CacheClone returns a clone of ResourceProfile used by ltcache CacheCloner

func (*ResourceProfile) Clone added in v0.11.0

func (rp *ResourceProfile) Clone() *ResourceProfile

Clone clones *ResourceProfile (lkID excluded)

func (*ResourceProfile) TenantID

func (rp *ResourceProfile) TenantID() string

TenantID returns unique identifier of the ResourceProfile in a multi-tenant environment

type ResourceProfileWithAPIOpts added in v0.11.0

type ResourceProfileWithAPIOpts struct {
	*ResourceProfile
	APIOpts map[string]any
}

ResourceProfileWithAPIOpts is used in replicatorV1 for dispatcher

type ResourceService

type ResourceService struct {
	// contains filtered or unexported fields
}

ResourceService is the service handling resources

func NewResourceService

func NewResourceService(dm *DataManager, cgrcfg *config.CGRConfig,
	filterS *FilterS, connMgr *ConnManager) *ResourceService

NewResourceService returns a new ResourceService

func (*ResourceService) Reload

func (rS *ResourceService) Reload()

Reload restarts the backup loop. No-op after Shutdown.

func (*ResourceService) Shutdown

func (rS *ResourceService) Shutdown()

Shutdown is called to shutdown the service

func (*ResourceService) StartLoop

func (rS *ResourceService) StartLoop()

StartLoop starts the goroutine with the backup loop

func (*ResourceService) V1AllocateResources added in v0.11.0

func (rS *ResourceService) V1AllocateResources(ctx *context.Context, args *utils.CGREvent, reply *string) (err error)

V1AllocateResources is called when a resource requires allocation

func (*ResourceService) V1AuthorizeResources

func (rS *ResourceService) V1AuthorizeResources(ctx *context.Context, args *utils.CGREvent, reply *string) (err error)

V1AuthorizeResources queries service to find if an Usage is allowed

func (*ResourceService) V1GetResource

func (rS *ResourceService) V1GetResource(ctx *context.Context, arg *utils.TenantIDWithAPIOpts, reply *Resource) error

V1GetResource returns a resource configuration

func (*ResourceService) V1GetResourceWithConfig added in v0.11.0

func (rS *ResourceService) V1GetResourceWithConfig(ctx *context.Context, arg *utils.TenantIDWithAPIOpts, reply *ResourceWithConfig) (err error)

func (*ResourceService) V1GetResourcesForEvent added in v0.11.0

func (rS *ResourceService) V1GetResourcesForEvent(ctx *context.Context, args *utils.CGREvent, reply *Resources) (err error)

V1GetResourcesForEvent returns active resource configs matching the event

func (*ResourceService) V1ReleaseResources added in v0.11.0

func (rS *ResourceService) V1ReleaseResources(ctx *context.Context, args *utils.CGREvent, reply *string) (err error)

V1ReleaseResources is called when we need to clear an allocation

type ResourceUsage

type ResourceUsage struct {
	Tenant     string
	ID         string // Unique identifier of this ResourceUsage, Eg: FreeSWITCH UUID
	ExpiryTime time.Time
	Units      float64 // Number of units used
}

ResourceUsage represents an usage counted

func (*ResourceUsage) Clone

func (ru *ResourceUsage) Clone() (cln *ResourceUsage)

Clone duplicates ru

func (*ResourceUsage) TenantID

func (ru *ResourceUsage) TenantID() string

TenantID returns the concatenated key between tenant and ID

type ResourceWithAPIOpts added in v0.11.0

type ResourceWithAPIOpts struct {
	*Resource
	APIOpts map[string]any
}

ResourceWithAPIOpts is used in replicatorV1 for dispatcher

type ResourceWithConfig added in v0.11.0

type ResourceWithConfig struct {
	*Resource
	Config *ResourceProfile
}

func (*ResourceWithConfig) Available added in v0.11.0

func (r *ResourceWithConfig) Available() float64

Available returns the available number of units Exported method to be used by filterS

type Resources

type Resources []*Resource

Resources is an orderable list of Resources based on Weight

func (Resources) Sort

func (rs Resources) Sort()

Sort sorts based on Weight

type Responder

type Responder struct {
	FilterS          *FilterS
	ShdChan          *utils.SyncedChan
	Timeout          time.Duration
	Timezone         string
	MaxComputedUsage map[string]time.Duration
	// contains filtered or unexported fields
}

func (*Responder) Debit

func (rs *Responder) Debit(ctx *context.Context, arg *CallDescriptorWithAPIOpts, reply *CallCost) (err error)

func (*Responder) DebitMonetary added in v0.11.0

func (rs *Responder) DebitMonetary(ctx *context.Context, cdr *CDRWithAPIOpts, reply *CallCost) (err error)

func (*Responder) GetCost

func (rs *Responder) GetCost(ctx *context.Context, arg *CallDescriptorWithAPIOpts, reply *CallCost) (err error)

RPC method that provides the external RPC interface for getting the rating information.

func (*Responder) GetCostOnRatingPlans added in v0.10.3

func (rs *Responder) GetCostOnRatingPlans(ctx *context.Context, arg *utils.GetCostOnRatingPlansArgs, reply *map[string]any) (err error)

GetCostOnRatingPlans is used by RouteS to calculate the cost Receive a list of RatingPlans and pick the first without error

func (*Responder) GetMaxSessionTime

func (rs *Responder) GetMaxSessionTime(ctx *context.Context, arg *CallDescriptorWithAPIOpts, reply *time.Duration) (err error)

func (*Responder) GetMaxSessionTimeOnAccounts added in v0.10.3

func (rs *Responder) GetMaxSessionTimeOnAccounts(ctx *context.Context, arg *utils.GetMaxSessionTimeOnAccountsArgs,
	reply *map[string]any) (err error)

func (*Responder) MaxDebit

func (rs *Responder) MaxDebit(ctx *context.Context, arg *CallDescriptorWithAPIOpts, reply *CallCost) (err error)

func (*Responder) RefundIncrements

func (rs *Responder) RefundIncrements(ctx *context.Context, arg *CallDescriptorWithAPIOpts, reply *Account) (err error)

func (*Responder) RefundRounding

func (rs *Responder) RefundRounding(ctx *context.Context, arg *CallDescriptorWithAPIOpts, reply *Account) (err error)

func (*Responder) SetMaxComputedUsage

func (rs *Responder) SetMaxComputedUsage(mx map[string]time.Duration)

SetMaxComputedUsage sets MaxComputedUsage, used for config reload (is thread safe)

func (*Responder) Shutdown

func (rs *Responder) Shutdown(ctx *context.Context, arg *utils.TenantWithAPIOpts, reply *string) (err error)

type ReverseDestinationsIHReply added in v0.10.3

type ReverseDestinationsIHReply struct {
	MissingReverseDestinations map[string][]string // list of missing indexes for each object (the map has the key as the indexKey and a list of objects)
	BrokenReferences           map[string][]string // list of broken references (the map has the key as the objectID and a list of indexes)
}

func GetReverseDestinationsIndexHealth added in v0.10.3

func GetReverseDestinationsIndexHealth(dm *DataManager, objLimit, indexLimit int, objTTL, indexTTL time.Duration, objStaticTTL, indexStaticTTL bool) (rply *ReverseDestinationsIHReply, err error)

add cache in args API

type ReverseFilterIHReply added in v0.11.0

type ReverseFilterIHReply struct {
	MissingObjects        []string            // list of object that are referenced in indexes but are not found in the dataDB
	MissingReverseIndexes map[string][]string // list of missing indexes for each object (the map has the key as the objectID and a list of indexes)
	BrokenReverseIndexes  map[string][]string // list of broken indexes for each object (the map has the key as the objectID and a list of indexes)
	MissingFilters        map[string][]string // list of broken references (the map has the key as the filterID and a list of  objectIDs)
}

type Route added in v0.11.0

type Route struct {
	ID              string // RouteID
	FilterIDs       []string
	AccountIDs      []string
	RatingPlanIDs   []string // used when computing price
	ResourceIDs     []string // queried in some strategies
	StatIDs         []string // queried in some strategies
	Weight          float64
	Blocker         bool // do not process further route after this one
	RouteParameters string
	// contains filtered or unexported fields
}

Route defines routes related information used within a RouteProfile

func (*Route) Clone added in v0.11.0

func (r *Route) Clone() *Route

Clone method for Route

type RouteMdl added in v0.11.0

type RouteMdl struct {
	PK                 uint `gorm:"primary_key"`
	Tpid               string
	Tenant             string  `index:"0" re:".*"`
	ID                 string  `index:"1" re:".*"`
	FilterIDs          string  `index:"2" re:".*"`
	ActivationInterval string  `index:"3" re:".*"`
	Sorting            string  `index:"4" re:".*"`
	SortingParameters  string  `index:"5" re:".*"`
	RouteID            string  `index:"6" re:".*"`
	RouteFilterIDs     string  `index:"7" re:".*"`
	RouteAccountIDs    string  `index:"8" re:".*"`
	RouteRatingplanIDs string  `index:"9" re:".*"`
	RouteResourceIDs   string  `index:"10" re:".*"`
	RouteStatIDs       string  `index:"11" re:".*"`
	RouteWeight        float64 `index:"12" re:".*"`
	RouteBlocker       bool    `index:"13" re:".*"`
	RouteParameters    string  `index:"14" re:".*"`
	Weight             float64 `index:"15" re:".*"`
	CreatedAt          time.Time
}

func (RouteMdl) TableName added in v0.11.0

func (RouteMdl) TableName() string

type RouteMdls added in v0.11.0

type RouteMdls []*RouteMdl

func APItoModelTPRoutes added in v0.11.0

func APItoModelTPRoutes(st *utils.TPRouteProfile) (mdls RouteMdls)

func (RouteMdls) AsTPRouteProfile added in v0.11.0

func (tps RouteMdls) AsTPRouteProfile() (result []*utils.TPRouteProfile)

func (RouteMdls) CSVHeader added in v0.11.0

func (tps RouteMdls) CSVHeader() (result []string)

CSVHeader return the header for csv fields as a slice of string

type RouteProfile added in v0.11.0

type RouteProfile struct {
	Tenant             string
	ID                 string // LCR Profile ID
	FilterIDs          []string
	ActivationInterval *utils.ActivationInterval // Activation interval
	Sorting            string                    // Sorting strategy
	SortingParameters  []string
	Routes             []*Route
	Weight             float64
}

RouteProfile represents the configuration of a Route profile

func APItoRouteProfile added in v0.11.0

func APItoRouteProfile(tpRp *utils.TPRouteProfile, timezone string) (rp *RouteProfile, err error)

func (*RouteProfile) CacheClone added in v0.11.0

func (rp *RouteProfile) CacheClone() any

CacheClone returns a clone of RouteProfile used by ltcache CacheCloner

func (*RouteProfile) Clone added in v0.11.0

func (rp *RouteProfile) Clone() *RouteProfile

Clone method for RouteProfile

func (*RouteProfile) Compile added in v0.11.0

func (rp *RouteProfile) Compile() error

Compile is a wrapper for convenience setting up the RouteProfile

func (*RouteProfile) TenantID added in v0.11.0

func (rp *RouteProfile) TenantID() string

TenantID returns unique identifier of the LCRProfile in a multi-tenant environment

type RouteProfileWithAPIOpts added in v0.11.0

type RouteProfileWithAPIOpts struct {
	*RouteProfile
	APIOpts map[string]any
}

RouteProfileWithAPIOpts is used in replicatorV1 for dispatcher

type RouteProfiles added in v0.11.0

type RouteProfiles []*RouteProfile

RouteProfiles is a sortable list of RouteProfile

func (RouteProfiles) Sort added in v0.11.0

func (lps RouteProfiles) Sort()

Sort is part of sort interface, sort based on Weight

type RouteService added in v0.11.0

type RouteService struct {
	// contains filtered or unexported fields
}

RouteService is the service computing route queries

func NewRouteService added in v0.11.0

func NewRouteService(dm *DataManager,
	filterS *FilterS, cgrcfg *config.CGRConfig, connMgr *ConnManager) (rS *RouteService)

NewRouteService initializes the Route Service

func (*RouteService) Shutdown added in v0.11.0

func (rpS *RouteService) Shutdown()

Shutdown is called to shutdown the service

func (*RouteService) V1GetRouteProfilesForEvent added in v0.11.0

func (rpS *RouteService) V1GetRouteProfilesForEvent(ctx *context.Context, args *utils.CGREvent, reply *[]*RouteProfile) (err error)

V1GetRouteProfilesForEvent returns the list of valid route profiles

func (*RouteService) V1GetRoutes added in v0.11.0

func (rpS *RouteService) V1GetRoutes(ctx *context.Context, args *utils.CGREvent, reply *SortedRoutesList) (err error)

V1GetRoutes returns the list of valid routes

func (*RouteService) V1GetRoutesList added in v0.11.0

func (rpS *RouteService) V1GetRoutesList(ctx *context.Context, args *utils.CGREvent, reply *[]string) (err error)

V1GetRoutesList returns the list of valid routes

type RouteSortDispatcher added in v0.11.0

type RouteSortDispatcher map[string]RoutesSorter

RouteSortDispatcher will initialize strategies and dispatch requests to them

func NewRouteSortDispatcher added in v0.11.0

func NewRouteSortDispatcher(lcrS *RouteService) (rsd RouteSortDispatcher)

NewRouteSortDispatcher constructs RouteSortDispatcher

func (RouteSortDispatcher) SortRoutes added in v0.11.0

func (ssd RouteSortDispatcher) SortRoutes(prflID, strategy string,
	suppls map[string]*Route, suplEv *utils.CGREvent, extraOpts *optsGetRoutes) (sortedRoutes *SortedRoutes, err error)

type RouteWithAPIOpts added in v0.11.0

type RouteWithAPIOpts struct {
	*RouteProfile
	APIOpts map[string]any
}

type RoutesSorter added in v0.11.0

type RoutesSorter interface {
	SortRoutes(string, map[string]*Route, *utils.CGREvent, *optsGetRoutes) (*SortedRoutes, error)
}

RoutesSorter is the interface which needs to be implemented by routes sorters

type SMCost

type SMCost struct {
	CGRID       string
	RunID       string
	OriginHost  string
	OriginID    string
	CostSource  string
	Usage       time.Duration
	CostDetails *EventCost
}

SMCost stores one Cost coming from SM

func (*SMCost) CacheClone added in v0.11.0

func (s *SMCost) CacheClone() any

CacheClone returns a clone of SMCost used by ltcache CacheCloner

func (*SMCost) Clone added in v0.11.0

func (s *SMCost) Clone() *SMCost

Clone clones SMCost

type SQItem

type SQItem struct {
	EventID    string     // Bounded to the original utils.CGREvent
	ExpiryTime *time.Time // Used to auto-expire events
}

type SQLImpl

type SQLImpl interface {
	// contains filtered or unexported methods
}

type SQLStorage

type SQLStorage struct {
	Db *sql.DB

	StorDB
	SQLImpl
	// contains filtered or unexported fields
}

func NewMySQLStorage

func NewMySQLStorage(host, port, name, user, password, mrshlerStr string,
	maxConn, maxIdleConn, logLevel int, connMaxLifetime time.Duration, location string, dsnParams map[string]string) (*SQLStorage, error)

func NewPostgresStorage

func NewPostgresStorage(host, port, name, user, password, pgSchema,
	sslmode, sslcert, sslkey, sslpassword, sslcertmode, sslrootcert string,
	maxConn, maxIdleConn, logLevel int, connMaxLifetime time.Duration) (*SQLStorage, error)

NewPostgresStorage returns the posgres storDB

func (*SQLStorage) BackupStorDB added in v0.11.0

func (sqls *SQLStorage) BackupStorDB(backupFolderPath string, zip bool) (err error)

BackupStorDB used only for InternalDB

func (*SQLStorage) Close

func (sqls *SQLStorage) Close()

func (*SQLStorage) CreateTablesFromScript

func (sqls *SQLStorage) CreateTablesFromScript(scriptPath string) error

func (*SQLStorage) DumpStorDB added in v0.11.0

func (sqls *SQLStorage) DumpStorDB() (err error)

Will dump everything inside stordb to a file, only for InternalDB

func (*SQLStorage) ExportGormDB

func (sqls *SQLStorage) ExportGormDB() *gorm.DB

func (*SQLStorage) Flush

func (sqls *SQLStorage) Flush(scriptsPath string) (err error)

func (*SQLStorage) GetCDRs

func (sqls *SQLStorage) GetCDRs(qryFltr *utils.CDRsFilter, remove bool) ([]*CDR, int64, error)

GetCDRs has ability to remove the selected CDRs, count them or simply return them qryFltr.Unscoped will ignore soft deletes or delete records permanently

func (*SQLStorage) GetKeysForPrefix

func (sqls *SQLStorage) GetKeysForPrefix(prefix, _ string) ([]string, error)

func (*SQLStorage) GetSMCosts

func (sqls *SQLStorage) GetSMCosts(cgrid, runid, originHost, originIDPrefix string) ([]*SMCost, error)

GetSMCosts is used to retrieve one or multiple SMCosts based on filter

func (*SQLStorage) GetTPAccountActions

func (sqls *SQLStorage) GetTPAccountActions(filter *utils.TPAccountActions) ([]*utils.TPAccountActions, error)

func (*SQLStorage) GetTPActionPlans

func (sqls *SQLStorage) GetTPActionPlans(tpid, id string) ([]*utils.TPActionPlan, error)

func (*SQLStorage) GetTPActionTriggers

func (sqls *SQLStorage) GetTPActionTriggers(tpid, id string) ([]*utils.TPActionTriggers, error)

func (*SQLStorage) GetTPActions

func (sqls *SQLStorage) GetTPActions(tpid, id string) ([]*utils.TPActions, error)

func (*SQLStorage) GetTPAttributes

func (sqls *SQLStorage) GetTPAttributes(tpid, tenant, id string) ([]*utils.TPAttributeProfile, error)

func (*SQLStorage) GetTPChargers

func (sqls *SQLStorage) GetTPChargers(tpid, tenant, id string) ([]*utils.TPChargerProfile, error)

func (*SQLStorage) GetTPDestinationRates

func (sqls *SQLStorage) GetTPDestinationRates(tpid, id string, pagination *utils.Paginator) ([]*utils.TPDestinationRate, error)

func (*SQLStorage) GetTPDestinations

func (sqls *SQLStorage) GetTPDestinations(tpid, id string) (uTPDsts []*utils.TPDestination, err error)

func (*SQLStorage) GetTPDispatcherHosts

func (sqls *SQLStorage) GetTPDispatcherHosts(tpid, tenant, id string) ([]*utils.TPDispatcherHost, error)

func (*SQLStorage) GetTPDispatcherProfiles

func (sqls *SQLStorage) GetTPDispatcherProfiles(tpid, tenant, id string) ([]*utils.TPDispatcherProfile, error)

func (*SQLStorage) GetTPFilters

func (sqls *SQLStorage) GetTPFilters(tpid, tenant, id string) ([]*utils.TPFilterProfile, error)

func (*SQLStorage) GetTPIPs added in v0.11.0

func (sqls *SQLStorage) GetTPIPs(tpid, tenant, id string) ([]*utils.TPIPProfile, error)

func (*SQLStorage) GetTPRankings added in v0.11.0

func (sqls *SQLStorage) GetTPRankings(tpid string, tenant string, id string) ([]*utils.TPRankingProfile, error)

func (*SQLStorage) GetTPRates

func (sqls *SQLStorage) GetTPRates(tpid, id string) ([]*utils.TPRateRALs, error)

func (*SQLStorage) GetTPRatingPlans

func (sqls *SQLStorage) GetTPRatingPlans(tpid, id string, pagination *utils.Paginator) ([]*utils.TPRatingPlan, error)

func (*SQLStorage) GetTPRatingProfiles

func (sqls *SQLStorage) GetTPRatingProfiles(filter *utils.TPRatingProfile) ([]*utils.TPRatingProfile, error)

func (*SQLStorage) GetTPResources

func (sqls *SQLStorage) GetTPResources(tpid, tenant, id string) ([]*utils.TPResourceProfile, error)

func (*SQLStorage) GetTPRoutes added in v0.11.0

func (sqls *SQLStorage) GetTPRoutes(tpid, tenant, id string) ([]*utils.TPRouteProfile, error)

func (*SQLStorage) GetTPSharedGroups

func (sqls *SQLStorage) GetTPSharedGroups(tpid, id string) ([]*utils.TPSharedGroups, error)

func (*SQLStorage) GetTPStats

func (sqls *SQLStorage) GetTPStats(tpid, tenant, id string) ([]*utils.TPStatProfile, error)

func (*SQLStorage) GetTPThresholds

func (sqls *SQLStorage) GetTPThresholds(tpid, tenant, id string) ([]*utils.TPThresholdProfile, error)

func (*SQLStorage) GetTPTimings

func (sqls *SQLStorage) GetTPTimings(tpid, id string) ([]*utils.ApierTPTiming, error)

func (*SQLStorage) GetTPTrends added in v0.11.0

func (sqls *SQLStorage) GetTPTrends(tpid, tenant, id string) ([]*utils.TPTrendsProfile, error)

func (*SQLStorage) GetTpIds

func (sqls *SQLStorage) GetTpIds(colName string) ([]string, error)

update Return a list with all TPids defined in the system, even if incomplete, isolated in some table.

func (*SQLStorage) GetTpTableIds

func (sqls *SQLStorage) GetTpTableIds(tpid, table string, distinct utils.TPDistinctIds,
	filters map[string]string, pagination *utils.PaginatorWithSearch) ([]string, error)

ToDo: TEST

func (*SQLStorage) GetVersions

func (sqls *SQLStorage) GetVersions(itm string) (vrs Versions, err error)

GetVersions returns slice of all versions or a specific version if tag is specified

func (*SQLStorage) IsDBEmpty

func (sqls *SQLStorage) IsDBEmpty() (resp bool, err error)

func (*SQLStorage) RemTpData

func (sqls *SQLStorage) RemTpData(table, tpid string, args map[string]string) error

func (SQLStorage) RemoveKeysForPrefix added in v0.11.0

func (SQLStorage) RemoveKeysForPrefix(string) error

func (*SQLStorage) RemoveSMCost

func (sqls *SQLStorage) RemoveSMCost(smc *SMCost) error

func (*SQLStorage) RemoveSMCosts

func (sqls *SQLStorage) RemoveSMCosts(qryFltr *utils.SMCostFilter) error

func (*SQLStorage) RemoveVersions

func (sqls *SQLStorage) RemoveVersions(vrs Versions) (err error)

RemoveVersions will remove specific versions out of storage

func (*SQLStorage) RestoreStorDB added in v0.11.0

func (sqls *SQLStorage) RestoreStorDB(backupFolderPath string) (err error)

RestoreStorDB used only for InternalDB

func (*SQLStorage) RewriteStorDB added in v0.11.0

func (sqls *SQLStorage) RewriteStorDB() (err error)

Will rewrite every dump file of StorDB, only for InternalDB

func (*SQLStorage) SetCDR

func (sqls *SQLStorage) SetCDR(cdr *CDR, allowUpdate bool) error

func (*SQLStorage) SetSMCost

func (sqls *SQLStorage) SetSMCost(smc *SMCost) error

func (*SQLStorage) SetTPAccountActions

func (sqls *SQLStorage) SetTPAccountActions(aas []*utils.TPAccountActions) error

Sets a group of account actions. Map key has the role of grouping within a tpid

func (*SQLStorage) SetTPActionPlans

func (sqls *SQLStorage) SetTPActionPlans(ats []*utils.TPActionPlan) error

func (*SQLStorage) SetTPActionTriggers

func (sqls *SQLStorage) SetTPActionTriggers(ats []*utils.TPActionTriggers) error

func (*SQLStorage) SetTPActions

func (sqls *SQLStorage) SetTPActions(acts []*utils.TPActions) error

func (*SQLStorage) SetTPAttributes

func (sqls *SQLStorage) SetTPAttributes(tpAttrs []*utils.TPAttributeProfile) error

func (*SQLStorage) SetTPChargers

func (sqls *SQLStorage) SetTPChargers(tpCPPs []*utils.TPChargerProfile) error

func (*SQLStorage) SetTPDestinationRates

func (sqls *SQLStorage) SetTPDestinationRates(drs []*utils.TPDestinationRate) error

func (*SQLStorage) SetTPDestinations

func (sqls *SQLStorage) SetTPDestinations(dests []*utils.TPDestination) error

func (*SQLStorage) SetTPDispatcherHosts

func (sqls *SQLStorage) SetTPDispatcherHosts(tpDPPs []*utils.TPDispatcherHost) error

func (*SQLStorage) SetTPDispatcherProfiles

func (sqls *SQLStorage) SetTPDispatcherProfiles(tpDPPs []*utils.TPDispatcherProfile) error

func (*SQLStorage) SetTPFilters

func (sqls *SQLStorage) SetTPFilters(ths []*utils.TPFilterProfile) error

func (*SQLStorage) SetTPIPs added in v0.11.0

func (sqls *SQLStorage) SetTPIPs(tps []*utils.TPIPProfile) error

func (*SQLStorage) SetTPRankings added in v0.11.0

func (sqls *SQLStorage) SetTPRankings(rgs []*utils.TPRankingProfile) error

func (*SQLStorage) SetTPRates

func (sqls *SQLStorage) SetTPRates(rs []*utils.TPRateRALs) error

func (*SQLStorage) SetTPRatingPlans

func (sqls *SQLStorage) SetTPRatingPlans(rps []*utils.TPRatingPlan) error

func (*SQLStorage) SetTPRatingProfiles

func (sqls *SQLStorage) SetTPRatingProfiles(rpfs []*utils.TPRatingProfile) error

func (*SQLStorage) SetTPResources

func (sqls *SQLStorage) SetTPResources(rls []*utils.TPResourceProfile) error

func (*SQLStorage) SetTPRoutes added in v0.11.0

func (sqls *SQLStorage) SetTPRoutes(tpRoutes []*utils.TPRouteProfile) error

func (*SQLStorage) SetTPSharedGroups

func (sqls *SQLStorage) SetTPSharedGroups(sgs []*utils.TPSharedGroups) error

func (*SQLStorage) SetTPStats

func (sqls *SQLStorage) SetTPStats(sts []*utils.TPStatProfile) error

func (*SQLStorage) SetTPThresholds

func (sqls *SQLStorage) SetTPThresholds(ths []*utils.TPThresholdProfile) error

func (*SQLStorage) SetTPTimings

func (sqls *SQLStorage) SetTPTimings(timings []*utils.ApierTPTiming) error

func (*SQLStorage) SetTPTrends added in v0.11.0

func (sqls *SQLStorage) SetTPTrends(trs []*utils.TPTrendsProfile) error

func (*SQLStorage) SnapshotStorDB added in v0.11.0

func (sqls *SQLStorage) SnapshotStorDB(backupFolderPath string, zip bool) (err error)

SnapshotStorDB used only for InternalDB

type STGroup

type STGroup struct {
	StateCode      string       // Tax State
	InvoiceNumber  string       // Invoice Number
	CustomerNumber string       // Customer number
	TaxList        []*STTaxItem // contains one-to-many Tax Items
}

Part of the SureTax Response

type STItemMessage

type STItemMessage struct {
	LineNumber   string // value corresponding to the line number in the web request
	ResponseCode string // a value in the range 9100-9400
	Message      string // the error message corresponding to the ResponseCode
}

Part of the SureTax Response

type STRequest

type STRequest struct {
	ClientNumber      string           // Client ID Number – provided by SureTax. Required. Max Len: 10
	BusinessUnit      string           // Client’s Business Unit. Value for this field is not required. Max Len: 20
	ValidationKey     string           // Validation Key provided by SureTax. Required for client access to API function. Max Len: 36
	DataYear          string           // Required. YYYY – Year to use for tax calculation purposes
	DataMonth         string           // Required. MM – Month to use for tax calculation purposes. Leading zero is preferred.
	TotalRevenue      float64          // Required. Format: $$$$$$$$$.CCCC. For Negative charges, the first position should have a minus ‘-‘ indicator.
	ReturnFileCode    string           // Required. 0 – Default.Q – Quote purposes – taxes are computed and returned in the response message for generating quotes.
	ClientTracking    string           // Field for client transaction tracking. This value will be provided in the response data. Value for this field is not required, but preferred. Max Len: 100
	IndustryExemption string           // Reserved for future use.
	ResponseGroup     string           // Required. Determines how taxes are grouped for the response.
	ResponseType      string           // Required. Determines the granularity of taxes and (optionally) the decimal precision for the tax calculations and amounts in the response.
	ItemList          []*STRequestItem // List of Item records
}

SureTax Request type

type STRequestItem

type STRequestItem struct {
	LineNumber           string   // Used to identify an item within the request. If no value is provided, requests are numbered sequentially. Max Len: 40
	InvoiceNumber        string   // Used for tax aggregation by Invoice. Must be alphanumeric. Max Len: 40
	CustomerNumber       string   // Used for tax aggregation by Customer. Must be alphanumeric. Max Len: 40
	OrigNumber           string   // Required when using Tax Situs Rule 01 or 03. Format: NPANXXNNNN
	TermNumber           string   // Required when using Tax Situs Rule 01. Format: NPANXXNNNN
	BillToNumber         string   // Required when using Tax Situs Rule 01 or 02. Format: NPANXXNNNN
	Zipcode              string   // Required when using Tax Situs Rule 04, 05, or 14.
	Plus4                string   // Zip code extension in format: 9999 (not applicable for Tax Situs Rule 14)
	P2PZipcode           string   // Secondary zip code in format: 99999 (US or US territory) or X9X9X9 (Canadian)
	P2PPlus4             string   // Secondary zip code extension in format: 99999 (US or US territory) or X9X9X9         (Canadian)
	TransDate            string   // Required. Date of transaction. Valid date formats include: MM/DD/YYYY, MM-DD-YYYY, YYYY-MM-DDTHH:MM:SS
	Revenue              float64  // Required. Format: $$$$$$$$$.CCCC. For Negative charges, the first position should have a minus ‘-‘indicator.
	Units                int64    // Required. Units representing number of “lines” or unique charges contained within the revenue. This value is essentially a multiplier on unit-based fees (e.g. E911 fees). Format: 99999. Default should be 1 (one unit).
	UnitType             string   // Required. 00 – Default / Number of unique access lines.
	Seconds              int64    // Required. Duration of call in seconds. Format 99999. Default should be 1.
	TaxIncludedCode      string   // Required. Values: 0 – Default (No Tax Included) 1 – Tax Included in Revenue
	TaxSitusRule         string   // Required.
	TransTypeCode        string   // Required. Transaction Type Indicator.
	SalesTypeCode        string   // Required. Values: R – Residential customer (default) B – Business customer I – Industrial customer L – Lifeline customer
	RegulatoryCode       string   // Required. Provider Type.
	TaxExemptionCodeList []string // Required. Tax Exemption to be applied to this item only.
}

Part of SureTax Request

type STResponse

type STResponse struct {
	Successful     string           // Response will be either ‘Y' or ‘N' : Y = Success / Success with Item error N = Failure
	ResponseCode   string           // ResponseCode: 9999 – Request was successful. 1101-1400 – Range of values for a failed request (no processing occurred) 9001 – Request was successful, but items within the request have errors. The specific items with errors are provided in the ItemMessages field.
	HeaderMessage  string           // Response message: For ResponseCode 9999 – “Success”For ResponseCode 9001 – “Success with Item errors”.  For ResponseCode 1100-1400 – Unsuccessful / declined web request.
	ItemMessages   []*STItemMessage // This field contains a list of items that were not able to be processed due to bad or invalid data (see Response Code of “9001”).
	ClientTracking string           // Client transaction tracking provided in web request.
	TotalTax       string           // Total Tax – a total of all taxes included in the TaxList
	TransId        int              // Transaction ID – provided by SureTax
	GroupList      []*STGroup       // contains one-to-many Groups
}

type STTaxItem

type STTaxItem struct {
	TaxTypeCode string // Tax Type Code
	TaxTypeDesc string // Tax Type Description
	TaxAmount   string // Tax Amount
}

Part of the SureTax Response

type SafEvent

type SafEvent struct {
	sync.RWMutex
	Me MapEvent // need it exportable so we can pass it on network
}

SafEvent is a generic event which is safe to read/write from multiple goroutines

func NewSafEvent

func NewSafEvent(mp map[string]any) *SafEvent

func (*SafEvent) AsCDR

func (se *SafEvent) AsCDR(cfg *config.CGRConfig, tnt, tmz string) (cdr *CDR, err error)

AsCDR exports the SafEvent as CDR

func (*SafEvent) AsCGREvent

func (se *SafEvent) AsCGREvent(tnt string) (cgrEv *utils.CGREvent)

AsCGREvent exports the SafEvent as CGREvent

func (*SafEvent) AsMapInterface

func (se *SafEvent) AsMapInterface() (mp map[string]any)

AsMapInterface returns the cloned map stored internally

func (*SafEvent) AsMapString

func (se *SafEvent) AsMapString(ignoredFlds utils.StringSet) (mp map[string]string)

AsMapString returns a map[string]string out of mp, ignoring specific fields if needed most used when needing to export extraFields

func (*SafEvent) Clone

func (se *SafEvent) Clone() (cln *SafEvent)

func (*SafEvent) FieldAsInterface

func (se *SafEvent) FieldAsInterface(fldPath []string) (out any, err error)

func (*SafEvent) FieldAsString

func (se *SafEvent) FieldAsString(fldPath []string) (out string, err error)

func (*SafEvent) Get

func (se *SafEvent) Get(fldName string) (out any, has bool)

func (*SafEvent) GetDuration

func (se *SafEvent) GetDuration(fldName string) (d time.Duration, err error)

GetDuration returns a field as Duration

func (*SafEvent) GetDurationIgnoreErrors

func (se *SafEvent) GetDurationIgnoreErrors(fldName string) (d time.Duration)

GetDuration returns a field as Duration, ignoring errors

func (*SafEvent) GetDurationOrDefault

func (se *SafEvent) GetDurationOrDefault(fldName string, dflt time.Duration) (d time.Duration, err error)

GetDurationPointer returns pointer towards duration, useful to detect presence of duration

func (*SafEvent) GetDurationPtr

func (se *SafEvent) GetDurationPtr(fldName string) (d *time.Duration, err error)

GetDurationPointer returns pointer towards duration, useful to detect presence of duration

func (*SafEvent) GetDurationPtrIgnoreErrors

func (se *SafEvent) GetDurationPtrIgnoreErrors(fldName string) (d *time.Duration)

GetDurationPointer returns pointer towards duration, useful to detect presence of duration

func (*SafEvent) GetDurationPtrOrDefault

func (se *SafEvent) GetDurationPtrOrDefault(fldName string, dflt *time.Duration) (d *time.Duration, err error)

GetDurationPointer returns pointer towards duration, useful to detect presence of duration

func (*SafEvent) GetIgnoreErrors

func (se *SafEvent) GetIgnoreErrors(fldName string) (out any)

func (*SafEvent) GetMapInterface

func (se *SafEvent) GetMapInterface() (mp map[string]any)

GetMapInterface returns the map stored internally without cloning it

func (*SafEvent) GetSetString

func (se *SafEvent) GetSetString(fldName string, setVal string) (out string, err error)

GetSet will attempt to get a field value if field not present set it to the value received as parameter

func (*SafEvent) GetString

func (se *SafEvent) GetString(fldName string) (out string, err error)

func (*SafEvent) GetStringIgnoreErrors

func (se *SafEvent) GetStringIgnoreErrors(fldName string) (out string)

func (*SafEvent) GetTInt64

func (se *SafEvent) GetTInt64(fldName string) (out int64, err error)

func (*SafEvent) GetTime

func (se *SafEvent) GetTime(fldName string, tmz string) (t time.Time, err error)

GetTime returns a field as Time

func (*SafEvent) GetTimeIgnoreErrors

func (se *SafEvent) GetTimeIgnoreErrors(fldName string, tmz string) (t time.Time)

GetTimeIgnoreErrors returns a field as Time instance, ignoring errors

func (*SafEvent) HasField

func (se *SafEvent) HasField(fldName string) (has bool)

func (*SafEvent) MapEvent

func (se *SafEvent) MapEvent() (mp MapEvent)

MapEvent offers access to MapEvent methods, avoiding locks

func (*SafEvent) Remove

func (se *SafEvent) Remove(fldName string)

Remove will remove a field from map

func (*SafEvent) Set

func (se *SafEvent) Set(fldName string, val any)

Set will set a field's value

func (*SafEvent) String

func (se *SafEvent) String() (out string)

type SessionCostsSQL

type SessionCostsSQL struct {
	ID          int64
	Cgrid       string
	RunID       string
	OriginHost  string
	OriginID    string
	CostSource  string
	Usage       int64
	CostDetails string
	CreatedAt   time.Time
	DeletedAt   *time.Time
}

func (SessionCostsSQL) TableName

func (t SessionCostsSQL) TableName() string

type SetAccountActionPlansArgWithAPIOpts added in v0.11.0

type SetAccountActionPlansArgWithAPIOpts struct {
	AcntID  string
	AplIDs  []string
	Tenant  string
	APIOpts map[string]any
}

SetAccountActionPlansArgWithAPIOpts is used to send the key and the Actions to replicator

type SetActionPlanArgWithAPIOpts added in v0.11.0

type SetActionPlanArgWithAPIOpts struct {
	Key     string
	Ats     *ActionPlan
	Tenant  string
	APIOpts map[string]any
}

SetActionPlanArgWithAPIOpts is used in replicatorV1 for dispatcher

type SetActionTriggersArgWithAPIOpts added in v0.11.0

type SetActionTriggersArgWithAPIOpts struct {
	Key     string
	Attrs   ActionTriggers
	Tenant  string
	APIOpts map[string]any
}

SetActionTriggersArgWithAPIOpts is used to send the key and the ActionTriggers to Replicator

type SetActionsArgsWithAPIOpts added in v0.11.0

type SetActionsArgsWithAPIOpts struct {
	Key     string
	Acs     Actions
	Tenant  string
	APIOpts map[string]any
}

SetActionsArgsWithOpts is used to send the key and the Actions to replicator

type SetBackupSessionsArgs added in v0.11.0

type SetBackupSessionsArgs struct {
	NodeID         string           // used as part of filter of DataDB query
	Tenant         string           // used as part of filter of DataDB query
	StoredSessions []*StoredSession // all active sessions ready for backup
}

type SharedActionsData added in v0.11.0

type SharedActionsData struct {
	// contains filtered or unexported fields
}

SharedActionsData holds shared data for processing actions within a group.

func NewSharedActionsData added in v0.11.0

func NewSharedActionsData(acts Actions) SharedActionsData

NewSharedActionsData initializes SharedActionsData based on the provided actions.

type SharedGroup

type SharedGroup struct {
	Id                string
	AccountParameters map[string]*SharingParameters
	MemberIds         utils.StringMap
}

func (*SharedGroup) Clone

func (sg *SharedGroup) Clone() (sharedGroup *SharedGroup)

Clone clones *SharedGroup

func (*SharedGroup) GetBalances

func (sg *SharedGroup) GetBalances(destination, category, balanceType string, ub *Account, aTime time.Time) (bc Balances)

Returns all shared group's balances collected from user accounts'

func (*SharedGroup) SortBalancesByStrategy

func (sg *SharedGroup) SortBalancesByStrategy(myBalance *Balance, bc Balances) Balances

type SharedGroupMdl added in v0.11.0

type SharedGroupMdl struct {
	Id            int64
	Tpid          string
	Tag           string `index:"0" re:".*"`
	Account       string `index:"1" re:".*"`
	Strategy      string `index:"2" re:".*"`
	RatingSubject string `index:"3" re:".*"`
	CreatedAt     time.Time
}

func (SharedGroupMdl) TableName added in v0.11.0

func (SharedGroupMdl) TableName() string

type SharedGroupMdls added in v0.11.0

type SharedGroupMdls []SharedGroupMdl

func APItoModelSharedGroup

func APItoModelSharedGroup(sgs *utils.TPSharedGroups) (result SharedGroupMdls)

func APItoModelSharedGroups

func APItoModelSharedGroups(sgs []*utils.TPSharedGroups) (result SharedGroupMdls)

func (SharedGroupMdls) AsMapTPSharedGroups added in v0.11.0

func (tps SharedGroupMdls) AsMapTPSharedGroups() (result map[string]*utils.TPSharedGroups)

func (SharedGroupMdls) AsTPSharedGroups added in v0.11.0

func (tps SharedGroupMdls) AsTPSharedGroups() (result []*utils.TPSharedGroups)

type SharedGroupWithAPIOpts added in v0.11.0

type SharedGroupWithAPIOpts struct {
	*SharedGroup
	Tenant  string
	APIOpts map[string]any
}

SharedGroupWithOpts is used in replicatorV1 for dispatcher

type SharingParameters

type SharingParameters struct {
	Strategy      string
	RatingSubject string
}

func (*SharingParameters) Clone

func (sp *SharingParameters) Clone() *SharingParameters

Clone clones *SharingParameters

type SortedRoute added in v0.11.0

type SortedRoute struct {
	RouteID         string
	RouteParameters string
	SortingData     map[string]any // store here extra info like cost or stats (can contain the data that we do not use to sort after)
	// contains filtered or unexported fields
}

SortedRoute represents one route in SortedRoutes

func (*SortedRoute) AsNavigableMap added in v0.11.0

func (ss *SortedRoute) AsNavigableMap() (nm *utils.DataNode)

type SortedRoutes added in v0.11.0

type SortedRoutes struct {
	ProfileID string         // Profile matched
	Sorting   string         // Sorting algorithm
	Routes    []*SortedRoute // list of route IDs and SortingData data
}

SortedRoutes is returned as part of GetRoutes call

func (*SortedRoutes) AsNavigableMap added in v0.11.0

func (sRoutes *SortedRoutes) AsNavigableMap() (nm *utils.DataNode)

func (*SortedRoutes) Digest added in v0.11.0

func (sRoutes *SortedRoutes) Digest() string

Digest returns list of routeIDs + parameters for easier outside access format route1:route1params,route2:route2params

func (*SortedRoutes) RouteIDs added in v0.11.0

func (sRoutes *SortedRoutes) RouteIDs() (rIDs []string)

RouteIDs returns a list of route IDs

func (*SortedRoutes) RoutesWithParams added in v0.11.0

func (sRoutes *SortedRoutes) RoutesWithParams() (sPs []string)

RoutesWithParams returns a list of routes IDs with Parameters

func (*SortedRoutes) SortHighestCost added in v0.11.0

func (sRoutes *SortedRoutes) SortHighestCost()

SortHighestCost is part of sort interface, sort descendent based on Cost with fallback on Weight

func (*SortedRoutes) SortLeastCost added in v0.11.0

func (sRoutes *SortedRoutes) SortLeastCost()

SortLeastCost is part of sort interface, sort ascendent based on Cost with fallback on Weight

func (*SortedRoutes) SortLoadDistribution added in v0.11.0

func (sRoutes *SortedRoutes) SortLoadDistribution()

SortLoadDistribution is part of sort interface, sort based on the following formula float64(metricVal/ratio) with fallback on Weight

func (*SortedRoutes) SortQOS added in v0.11.0

func (sRoutes *SortedRoutes) SortQOS(params []string)

SortQOS is part of sort interface, sort based on Stats

func (*SortedRoutes) SortResourceAscendent added in v0.11.0

func (sRoutes *SortedRoutes) SortResourceAscendent()

SortResourceAscendent is part of sort interface, sort ascendent based on ResourceUsage with fallback on Weight

func (*SortedRoutes) SortResourceDescendent added in v0.11.0

func (sRoutes *SortedRoutes) SortResourceDescendent()

SortResourceDescendent is part of sort interface, sort descendent based on ResourceUsage with fallback on Weight

func (*SortedRoutes) SortWeight added in v0.11.0

func (sRoutes *SortedRoutes) SortWeight()

SortWeight is part of sort interface, sort based on Weight

type SortedRoutesList added in v0.11.0

type SortedRoutesList []*SortedRoutes

SortedRoutesList represents the list of matched routes grouped based of profile

func (SortedRoutesList) AsNavigableMap added in v0.11.0

func (sRs SortedRoutesList) AsNavigableMap() (nm *utils.DataNode)

AsNavigableMap returns the SortedRoutesSet as NMInterface object

func (SortedRoutesList) Digest added in v0.11.0

func (sRs SortedRoutesList) Digest(setRouteProfile bool) string

Digest returns list of routeIDs + parameters for easier outside access format route1:route1params,route2:route2params

func (SortedRoutesList) RouteIDs added in v0.11.0

func (sRs SortedRoutesList) RouteIDs() (rIDs []string)

RouteIDs returns a list of route IDs. Attach RouteProfileID to the RouteIDs if RouteProfile is enabled in RouteSCfg

func (SortedRoutesList) RoutesWithParams added in v0.11.0

func (sRs SortedRoutesList) RoutesWithParams(setRouteProfile bool) (sPs []string)

RoutesWithParams returns a list of routes IDs with Parameters

type StatACC

type StatACC struct {
	FilterIDs []string
	Sum       float64
	Count     int64
	Events    map[string]*StatWithCompress // map[EventTenantID]Cost
	MinItems  int
	// contains filtered or unexported fields
}

ACC implements AverageCallCost metric

func (*StatACC) AddEvent

func (acc *StatACC) AddEvent(evID string, ev utils.DataProvider) (err error)

func (*StatACC) AddOneEvent added in v0.11.0

func (acc *StatACC) AddOneEvent(ev utils.DataProvider) (err error)

func (*StatACC) Clone added in v0.11.0

func (s *StatACC) Clone() StatMetric

Clone creates a deep copy of StatACC

func (*StatACC) Compress

func (acc *StatACC) Compress(queueLen int64, defaultID string, roundingDecimal int) (eventIDs []string)

Compress is part of StatMetric interface

func (*StatACC) GetCompressFactor

func (acc *StatACC) GetCompressFactor(events map[string]int) map[string]int

Compress is part of StatMetric interface

func (*StatACC) GetFilterIDs

func (acc *StatACC) GetFilterIDs() []string

GetFilterIDs is part of StatMetric interface

func (*StatACC) GetFloat64Value

func (acc *StatACC) GetFloat64Value(roundingDecimal int) (v float64)

func (*StatACC) GetMinItems added in v0.11.0

func (acc *StatACC) GetMinItems() (minIts int)

GetMinItems returns the minim items for the metric

func (*StatACC) GetStringValue

func (acc *StatACC) GetStringValue(roundingDecimal int) (valStr string)

func (*StatACC) GetValue

func (acc *StatACC) GetValue(roundingDecimal int) (v any)

func (*StatACC) LoadMarshaled

func (acc *StatACC) LoadMarshaled(ms Marshaler, marshaled []byte) (err error)

func (*StatACC) Marshal

func (acc *StatACC) Marshal(ms Marshaler) (marshaled []byte, err error)

func (*StatACC) RemEvent

func (acc *StatACC) RemEvent(evID string)

type StatACD

type StatACD struct {
	FilterIDs []string
	Sum       time.Duration
	Count     int64
	Events    map[string]*DurationWithCompress // map[EventTenantID]Duration
	MinItems  int
	// contains filtered or unexported fields
}

ACD implements AverageCallDuration metric

func (*StatACD) AddEvent

func (acd *StatACD) AddEvent(evID string, ev utils.DataProvider) (err error)

func (*StatACD) AddOneEvent added in v0.11.0

func (acd *StatACD) AddOneEvent(ev utils.DataProvider) (err error)

func (*StatACD) Clone added in v0.11.0

func (s *StatACD) Clone() StatMetric

Clone creates a deep copy of StatACD

func (*StatACD) Compress

func (acd *StatACD) Compress(queueLen int64, defaultID string, roundingDecimal int) (eventIDs []string)

Compress is part of StatMetric interface

func (*StatACD) GetCompressFactor

func (acd *StatACD) GetCompressFactor(events map[string]int) map[string]int

Compress is part of StatMetric interface

func (*StatACD) GetFilterIDs

func (acd *StatACD) GetFilterIDs() []string

GetFilterIDs is part of StatMetric interface

func (*StatACD) GetFloat64Value

func (acd *StatACD) GetFloat64Value(roundingDecimal int) (v float64)

func (*StatACD) GetMinItems added in v0.11.0

func (acd *StatACD) GetMinItems() (minIts int)

GetMinItems returns the minim items for the metric

func (*StatACD) GetStringValue

func (acd *StatACD) GetStringValue(roundingDecimal int) (valStr string)

func (*StatACD) GetValue

func (acd *StatACD) GetValue(roundingDecimal int) (v any)

func (*StatACD) LoadMarshaled

func (acd *StatACD) LoadMarshaled(ms Marshaler, marshaled []byte) (err error)

func (*StatACD) Marshal

func (acd *StatACD) Marshal(ms Marshaler) (marshaled []byte, err error)

func (*StatACD) RemEvent

func (acd *StatACD) RemEvent(evID string)

type StatASR

type StatASR struct {
	FilterIDs []string
	Answered  float64
	Count     int64
	Events    map[string]*StatWithCompress // map[EventTenantID]Answered
	MinItems  int
	// contains filtered or unexported fields
}

ASR implements AverageSuccessRatio metric

func (*StatASR) AddEvent

func (asr *StatASR) AddEvent(evID string, ev utils.DataProvider) (err error)

AddEvent is part of StatMetric interface

func (*StatASR) AddOneEvent added in v0.11.0

func (asr *StatASR) AddOneEvent(ev utils.DataProvider) (err error)

AddOneEvent aggregates the metric value without storing the events

func (*StatASR) Clone added in v0.11.0

func (s *StatASR) Clone() StatMetric

Clone creates a deep copy of StatASR

func (*StatASR) Compress

func (asr *StatASR) Compress(queueLen int64, defaultID string, roundingDecimal int) (eventIDs []string)

Compress is part of StatMetric interface

func (*StatASR) GetCompressFactor

func (asr *StatASR) GetCompressFactor(events map[string]int) map[string]int

Compress is part of StatMetric interface

func (*StatASR) GetFilterIDs

func (asr *StatASR) GetFilterIDs() []string

GetFilterIDs is part of StatMetric interface

func (*StatASR) GetFloat64Value

func (asr *StatASR) GetFloat64Value(roundingDecimal int) (val float64)

GetFloat64Value is part of StatMetric interface

func (*StatASR) GetMinItems added in v0.11.0

func (asr *StatASR) GetMinItems() (minIts int)

GetMinItems returns the minim items for the metric

func (*StatASR) GetStringValue

func (asr *StatASR) GetStringValue(roundingDecimal int) (valStr string)

func (*StatASR) GetValue

func (asr *StatASR) GetValue(roundingDecimal int) (v any)

GetValue returns the ASR value as part of StatMetric interface

func (*StatASR) LoadMarshaled

func (asr *StatASR) LoadMarshaled(ms Marshaler, marshaled []byte) (err error)

LoadMarshaled is part of StatMetric interface

func (*StatASR) Marshal

func (asr *StatASR) Marshal(ms Marshaler) (marshaled []byte, err error)

Marshal is part of StatMetric interface

func (*StatASR) RemEvent

func (asr *StatASR) RemEvent(evID string)

RemEvent deletes a stored event and decrements statistics of the metric for recalculation

type StatAverage

type StatAverage struct {
	FilterIDs []string
	Sum       float64
	Count     int64
	Events    map[string]*StatWithCompress // map[EventTenantID]Cost
	MinItems  int
	FieldName string
	// contains filtered or unexported fields
}

StatAverage implements TotalCallCost metric

func (*StatAverage) AddEvent

func (avg *StatAverage) AddEvent(evID string, ev utils.DataProvider) (err error)

func (*StatAverage) AddOneEvent added in v0.11.0

func (avg *StatAverage) AddOneEvent(ev utils.DataProvider) (err error)

simply remove the ~*req. prefix and do normal process

func (*StatAverage) Clone added in v0.11.0

func (s *StatAverage) Clone() StatMetric

Clone creates a deep copy of StatAverage

func (*StatAverage) Compress

func (avg *StatAverage) Compress(queueLen int64, defaultID string, roundingDecimal int) (eventIDs []string)

Compress is part of StatMetric interface

func (*StatAverage) GetCompressFactor

func (avg *StatAverage) GetCompressFactor(events map[string]int) map[string]int

Compress is part of StatMetric interface

func (*StatAverage) GetFilterIDs

func (avg *StatAverage) GetFilterIDs() []string

GetFilterIDs is part of StatMetric interface

func (*StatAverage) GetFloat64Value

func (avg *StatAverage) GetFloat64Value(roundingDecimal int) (v float64)

func (*StatAverage) GetMinItems added in v0.11.0

func (avg *StatAverage) GetMinItems() (minIts int)

GetMinItems returns the minim items for the metric

func (*StatAverage) GetStringValue

func (avg *StatAverage) GetStringValue(roundingDecimal int) (valStr string)

func (*StatAverage) GetValue

func (avg *StatAverage) GetValue(roundingDecimal int) (v any)

func (*StatAverage) LoadMarshaled

func (avg *StatAverage) LoadMarshaled(ms Marshaler, marshaled []byte) (err error)

func (*StatAverage) Marshal

func (avg *StatAverage) Marshal(ms Marshaler) (marshaled []byte, err error)

func (*StatAverage) RemEvent

func (avg *StatAverage) RemEvent(evID string)

type StatDDC

type StatDDC struct {
	FilterIDs   []string
	FieldValues map[string]utils.StringSet  // map[fieldValue]map[eventID]
	Events      map[string]map[string]int64 // map[EventTenantID]map[fieldValue]compressfactor
	MinItems    int
	Count       int64
}

func (*StatDDC) AddEvent

func (ddc *StatDDC) AddEvent(evID string, ev utils.DataProvider) (err error)

func (*StatDDC) AddOneEvent added in v0.11.0

func (ddc *StatDDC) AddOneEvent(ev utils.DataProvider) (err error)

func (*StatDDC) Clone added in v0.11.0

func (s *StatDDC) Clone() StatMetric

Clone creates a deep copy of StatDDC

func (*StatDDC) Compress

func (ddc *StatDDC) Compress(queueLen int64, defaultID string, roundingDecimal int) (eventIDs []string)

func (*StatDDC) GetCompressFactor

func (ddc *StatDDC) GetCompressFactor(events map[string]int) map[string]int

Compress is part of StatMetric interface

func (*StatDDC) GetFilterIDs

func (ddc *StatDDC) GetFilterIDs() []string

GetFilterIDs is part of StatMetric interface

func (*StatDDC) GetFloat64Value

func (ddc *StatDDC) GetFloat64Value(roundingDecimal int) (v float64)

func (*StatDDC) GetMinItems added in v0.11.0

func (ddc *StatDDC) GetMinItems() (minIts int)

GetMinItems returns the minim items for the metric

func (*StatDDC) GetStringValue

func (ddc *StatDDC) GetStringValue(roundingDecimal int) (valStr string)

func (*StatDDC) GetValue

func (ddc *StatDDC) GetValue(roundingDecimal int) (v any)

func (*StatDDC) LoadMarshaled

func (ddc *StatDDC) LoadMarshaled(ms Marshaler, marshaled []byte) (err error)

func (*StatDDC) Marshal

func (ddc *StatDDC) Marshal(ms Marshaler) (marshaled []byte, err error)

func (*StatDDC) RemEvent

func (ddc *StatDDC) RemEvent(evID string)

type StatDistinct

type StatDistinct struct {
	FilterIDs   []string
	FieldValues map[string]utils.StringSet  // map[fieldValue]map[eventID]
	Events      map[string]map[string]int64 // map[EventTenantID]map[fieldValue]compressfactor
	MinItems    int
	FieldName   string
	Count       int64
}

func (*StatDistinct) AddEvent

func (dst *StatDistinct) AddEvent(evID string, ev utils.DataProvider) (err error)

func (*StatDistinct) AddOneEvent added in v0.11.0

func (dst *StatDistinct) AddOneEvent(ev utils.DataProvider) (err error)

func (*StatDistinct) Clone added in v0.11.0

func (s *StatDistinct) Clone() StatMetric

Clone creates a deep copy of StatDistinct

func (*StatDistinct) Compress

func (dst *StatDistinct) Compress(queueLen int64, defaultID string, roundingDecimal int) (eventIDs []string)

func (*StatDistinct) GetCompressFactor

func (dst *StatDistinct) GetCompressFactor(events map[string]int) map[string]int

Compress is part of StatMetric interface

func (*StatDistinct) GetFilterIDs

func (dst *StatDistinct) GetFilterIDs() []string

GetFilterIDs is part of StatMetric interface

func (*StatDistinct) GetFloat64Value

func (dst *StatDistinct) GetFloat64Value(roundingDecimal int) (v float64)

func (*StatDistinct) GetMinItems added in v0.11.0

func (dst *StatDistinct) GetMinItems() (minIts int)

GetMinItems returns the minim items for the metric

func (*StatDistinct) GetStringValue

func (dst *StatDistinct) GetStringValue(roundingDecimal int) (valStr string)

func (*StatDistinct) GetValue

func (dst *StatDistinct) GetValue(roundingDecimal int) (v any)

func (*StatDistinct) LoadMarshaled

func (dst *StatDistinct) LoadMarshaled(ms Marshaler, marshaled []byte) (err error)

func (*StatDistinct) Marshal

func (dst *StatDistinct) Marshal(ms Marshaler) (marshaled []byte, err error)

func (*StatDistinct) RemEvent

func (dst *StatDistinct) RemEvent(evID string)

type StatHighest added in v0.11.0

type StatHighest struct {
	FilterIDs []string // event filters to apply before processing
	FieldName string   // field path to extract from events
	MinItems  int      // minimum events required for valid results

	Highest float64            // current maximum value tracked
	Count   int64              // number of events currently tracked
	Events  map[string]float64 // event values indexed by ID for deletion
	// contains filtered or unexported fields
}

StatHighest tracks the maximum value for a specific field across events.

func (*StatHighest) AddEvent added in v0.11.0

func (s *StatHighest) AddEvent(evID string, ev utils.DataProvider) error

AddEvent processes a new event, updating highest value if necessary

func (*StatHighest) AddOneEvent added in v0.11.0

func (s *StatHighest) AddOneEvent(ev utils.DataProvider) error

AddOneEvent processes event without storing for removal (used when events never expire).

func (*StatHighest) Clone added in v0.11.0

func (s *StatHighest) Clone() StatMetric

Clone creates a deep copy of StatHighest.

func (*StatHighest) Compress added in v0.11.0

func (s *StatHighest) Compress(queueLen int64, defaultID string, decimals int) []string

Compress is part of StatMetric interface.

func (*StatHighest) GetCompressFactor added in v0.11.0

func (s *StatHighest) GetCompressFactor(events map[string]int) map[string]int

func (*StatHighest) GetFilterIDs added in v0.11.0

func (s *StatHighest) GetFilterIDs() []string

GetFilterIDs is part of StatMetric interface.

func (*StatHighest) GetFloat64Value added in v0.11.0

func (s *StatHighest) GetFloat64Value(decimals int) float64

func (*StatHighest) GetMinItems added in v0.11.0

func (s *StatHighest) GetMinItems() int

GetMinItems returns the minimum items for the metric.

func (*StatHighest) GetStringValue added in v0.11.0

func (s *StatHighest) GetStringValue(decimals int) string

func (*StatHighest) GetValue added in v0.11.0

func (s *StatHighest) GetValue(decimals int) any

func (*StatHighest) LoadMarshaled added in v0.11.0

func (s *StatHighest) LoadMarshaled(ms Marshaler, marshaled []byte) error

func (*StatHighest) Marshal added in v0.11.0

func (s *StatHighest) Marshal(ms Marshaler) ([]byte, error)

func (*StatHighest) RemEvent added in v0.11.0

func (s *StatHighest) RemEvent(evID string)

type StatLowest added in v0.11.0

type StatLowest struct {
	FilterIDs []string // event filters to apply before processing
	FieldName string   // field path to extract from events
	MinItems  int      // minimum events required for valid results

	Lowest float64            // current minimum value tracked
	Count  int64              // number of events currently tracked
	Events map[string]float64 // event values indexed by ID for deletion
	// contains filtered or unexported fields
}

StatLowest tracks the minimum value for a specific field across events.

func (*StatLowest) AddEvent added in v0.11.0

func (s *StatLowest) AddEvent(evID string, ev utils.DataProvider) error

AddEvent processes a new event, updating lowest value if necessary.

func (*StatLowest) AddOneEvent added in v0.11.0

func (s *StatLowest) AddOneEvent(ev utils.DataProvider) error

AddOneEvent processes event without storing for removal (used when events never expire).

func (*StatLowest) Clone added in v0.11.0

func (s *StatLowest) Clone() StatMetric

Clone creates a deep copy of StatLowest.

func (*StatLowest) Compress added in v0.11.0

func (s *StatLowest) Compress(queueLen int64, defaultID string, decimals int) []string

Compress is part of StatMetric interface.

func (*StatLowest) GetCompressFactor added in v0.11.0

func (s *StatLowest) GetCompressFactor(events map[string]int) map[string]int

func (*StatLowest) GetFilterIDs added in v0.11.0

func (s *StatLowest) GetFilterIDs() []string

GetFilterIDs is part of StatMetric interface.

func (*StatLowest) GetFloat64Value added in v0.11.0

func (s *StatLowest) GetFloat64Value(decimals int) float64

func (*StatLowest) GetMinItems added in v0.11.0

func (s *StatLowest) GetMinItems() int

GetMinItems returns the minimum items for the metric.

func (*StatLowest) GetStringValue added in v0.11.0

func (s *StatLowest) GetStringValue(decimals int) string

func (*StatLowest) GetValue added in v0.11.0

func (s *StatLowest) GetValue(decimals int) any

func (*StatLowest) LoadMarshaled added in v0.11.0

func (s *StatLowest) LoadMarshaled(ms Marshaler, marshaled []byte) error

func (*StatLowest) Marshal added in v0.11.0

func (s *StatLowest) Marshal(ms Marshaler) ([]byte, error)

func (*StatLowest) RemEvent added in v0.11.0

func (s *StatLowest) RemEvent(evID string)

type StatMdl added in v0.11.0

type StatMdl struct {
	PK                 uint `gorm:"primary_key"`
	Tpid               string
	Tenant             string  `index:"0" re:".*"`
	ID                 string  `index:"1" re:".*"`
	FilterIDs          string  `index:"2" re:".*"`
	ActivationInterval string  `index:"3" re:".*"`
	QueueLength        int     `index:"4" re:".*"`
	TTL                string  `index:"5" re:".*"`
	MinItems           int     `index:"6" re:".*"`
	MetricIDs          string  `index:"7" re:".*"`
	MetricFilterIDs    string  `index:"8" re:".*"`
	Stored             bool    `index:"9" re:".*"`
	Blocker            bool    `index:"10" re:".*"`
	Weight             float64 `index:"11" re:".*"`
	ThresholdIDs       string  `index:"12" re:".*"`
	CreatedAt          time.Time
}

func (StatMdl) TableName added in v0.11.0

func (StatMdl) TableName() string

type StatMdls added in v0.11.0

type StatMdls []*StatMdl

func APItoModelStats

func APItoModelStats(st *utils.TPStatProfile) (mdls StatMdls)

func (StatMdls) AsTPStats added in v0.11.0

func (models StatMdls) AsTPStats() (result []*utils.TPStatProfile)

func (StatMdls) CSVHeader added in v0.11.0

func (tps StatMdls) CSVHeader() (result []string)

CSVHeader return the header for csv fields as a slice of string

type StatMetric

type StatMetric interface {
	GetValue(roundingDecimal int) any
	GetStringValue(roundingDecimal int) (val string)
	GetFloat64Value(roundingDecimal int) (val float64)
	AddEvent(evID string, ev utils.DataProvider) error
	AddOneEvent(ev utils.DataProvider) error
	RemEvent(evTenantID string)
	Marshal(ms Marshaler) (marshaled []byte, err error)
	LoadMarshaled(ms Marshaler, marshaled []byte) (err error)
	GetFilterIDs() (filterIDs []string)
	GetMinItems() (minIts int)
	Compress(queueLen int64, defaultID string, roundingDec int) (eventIDs []string)
	GetCompressFactor(events map[string]int) map[string]int
	Clone() StatMetric
}

StatMetric is the interface which a metric should implement

func NewACC

func NewACC(minItems int, extraParams string, filterIDs []string) (StatMetric, error)

func NewACD

func NewACD(minItems int, extraParams string, filterIDs []string) (StatMetric, error)

func NewASR

func NewASR(minItems int, extraParams string, filterIDs []string) (StatMetric, error)

func NewDDC

func NewDDC(minItems int, extraParams string, filterIDs []string) (StatMetric, error)

func NewPDD

func NewPDD(minItems int, extraParams string, filterIDs []string) (StatMetric, error)

func NewStatAverage

func NewStatAverage(minItems int, extraParams string, filterIDs []string) (StatMetric, error)

func NewStatDistinct

func NewStatDistinct(minItems int, extraParams string, filterIDs []string) (StatMetric, error)

func NewStatHighest added in v0.11.0

func NewStatHighest(minItems int, fieldName string, filterIDs []string) (StatMetric, error)

NewStatHighest creates a StatHighest metric for tracking maximum field values.

func NewStatLowest added in v0.11.0

func NewStatLowest(minItems int, fieldName string, filterIDs []string) (StatMetric, error)

NewStatLowest creates a StatLowest metric for tracking minimum field values.

func NewStatMetric

func NewStatMetric(metricID string, minItems int, filterIDs []string) (sm StatMetric, err error)

NewStatMetric instantiates the StatMetric cfg serves as general purpose container to pass config options to metric

func NewStatREPFC added in v0.11.0

func NewStatREPFC(minItems int, errorType string, filterIDs []string) (StatMetric, error)

NewStatREPFC creates a StatREPFC metric for counting failed requests.

func NewStatREPSC added in v0.11.0

func NewStatREPSC(minItems int, _ string, filterIDs []string) (StatMetric, error)

NewStatREPSC creates a StatREPSC metric for counting successful requests.

func NewStatSum

func NewStatSum(minItems int, extraParams string, filterIDs []string) (StatMetric, error)

func NewTCC

func NewTCC(minItems int, extraParams string, filterIDs []string) (StatMetric, error)

func NewTCD

func NewTCD(minItems int, extraParams string, filterIDs []string) (StatMetric, error)

type StatPDD

type StatPDD struct {
	FilterIDs []string
	Sum       time.Duration
	Count     int64
	Events    map[string]*DurationWithCompress // map[EventTenantID]Duration
	MinItems  int
	// contains filtered or unexported fields
}

PDD implements Post Dial Delay (average) metric

func (*StatPDD) AddEvent

func (pdd *StatPDD) AddEvent(evID string, ev utils.DataProvider) (err error)

func (*StatPDD) AddOneEvent added in v0.11.0

func (pdd *StatPDD) AddOneEvent(ev utils.DataProvider) (err error)

func (*StatPDD) Clone added in v0.11.0

func (s *StatPDD) Clone() StatMetric

Clone creates a deep copy of StatPDD

func (*StatPDD) Compress

func (pdd *StatPDD) Compress(queueLen int64, defaultID string, roundingDecimal int) (eventIDs []string)

Compress is part of StatMetric interface

func (*StatPDD) GetCompressFactor

func (pdd *StatPDD) GetCompressFactor(events map[string]int) map[string]int

Compress is part of StatMetric interface

func (*StatPDD) GetFilterIDs

func (pdd *StatPDD) GetFilterIDs() []string

GetFilterIDs is part of StatMetric interface

func (*StatPDD) GetFloat64Value

func (pdd *StatPDD) GetFloat64Value(roundingDecimal int) (v float64)

func (*StatPDD) GetMinItems added in v0.11.0

func (pdd *StatPDD) GetMinItems() (minIts int)

GetMinItems returns the minim items for the metric

func (*StatPDD) GetStringValue

func (pdd *StatPDD) GetStringValue(roundingDecimal int) (valStr string)

func (*StatPDD) GetValue

func (pdd *StatPDD) GetValue(roundingDecimal int) (v any)

func (*StatPDD) LoadMarshaled

func (pdd *StatPDD) LoadMarshaled(ms Marshaler, marshaled []byte) (err error)

func (*StatPDD) Marshal

func (pdd *StatPDD) Marshal(ms Marshaler) (marshaled []byte, err error)

func (*StatPDD) RemEvent

func (pdd *StatPDD) RemEvent(evID string)

type StatQueue

type StatQueue struct {
	Tenant    string
	ID        string
	SQItems   []SQItem
	SQMetrics map[string]StatMetric
	// contains filtered or unexported fields
}

StatQueue represents an individual stats instance

func NewStatQueue added in v0.11.0

func NewStatQueue(tnt, id string, metrics []*MetricWithFilters, minItems int) (sq *StatQueue, err error)

func (*StatQueue) CacheClone added in v0.11.0

func (sq *StatQueue) CacheClone() any

CacheClone returns a clone of StatQueue used by ltcache CacheCloner

func (*StatQueue) Clone added in v0.11.0

func (sq *StatQueue) Clone() *StatQueue

Clone clones *StatQueue (lkID excluded)

func (*StatQueue) Compress

func (sq *StatQueue) Compress(maxQL int64, roundDec int) bool

func (*StatQueue) Expand

func (sq *StatQueue) Expand()

func (*StatQueue) ProcessEvent

func (sq *StatQueue) ProcessEvent(tnt, evID string, filterS *FilterS, evNm utils.MapStorage) error

ProcessEvent processes a utils.CGREvent, returns true if processed

func (*StatQueue) TenantID

func (sq *StatQueue) TenantID() string

TenantID will compose the unique identifier for the StatQueue out of Tenant and ID

func (*StatQueue) UnmarshalJSON added in v0.11.0

func (sq *StatQueue) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON here only to fully support json for StatQueue

type StatQueueProfile

type StatQueueProfile struct {
	Tenant             string
	ID                 string // QueueID
	FilterIDs          []string
	ActivationInterval *utils.ActivationInterval // Activation interval
	QueueLength        int
	TTL                time.Duration
	MinItems           int
	Metrics            []*MetricWithFilters // list of metrics to build
	Stored             bool
	Blocker            bool // blocker flag to stop processing on filters matched
	Weight             float64
	ThresholdIDs       []string // list of thresholds to be checked after changes
	// contains filtered or unexported fields
}

StatsConfig represents the configuration of a StatsInstance in StatS

func APItoStats

func APItoStats(tpST *utils.TPStatProfile, timezone string) (st *StatQueueProfile, err error)

func (*StatQueueProfile) CacheClone added in v0.11.0

func (sqp *StatQueueProfile) CacheClone() any

CacheClone returns a clone of StatQueueProfile used by ltcache CacheCloner

func (*StatQueueProfile) Clone added in v0.11.0

func (sqp *StatQueueProfile) Clone() *StatQueueProfile

Clone clones *StatQueueProfile (lkID excluded)

func (*StatQueueProfile) TenantID

func (sqp *StatQueueProfile) TenantID() string

type StatQueueProfileWithAPIOpts added in v0.11.0

type StatQueueProfileWithAPIOpts struct {
	*StatQueueProfile
	APIOpts map[string]any
}

StatQueueProfileWithAPIOpts is used in replicatorV1 for dispatcher

type StatQueueWithAPIOpts added in v0.11.0

type StatQueueWithAPIOpts struct {
	*StatQueue
	APIOpts map[string]any
}

func (*StatQueueWithAPIOpts) UnmarshalJSON added in v0.11.0

func (ssq *StatQueueWithAPIOpts) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON here only to fully support json for StatQueue

type StatQueues

type StatQueues []*StatQueue

StatQueues is a sortable list of StatQueue

func (StatQueues) IDs added in v0.11.0

func (sis StatQueues) IDs() []string

func (StatQueues) Sort

func (sis StatQueues) Sort()

Sort is part of sort interface, sort based on Weight

type StatREPFC added in v0.11.0

type StatREPFC struct {
	FilterIDs []string            // event filters to apply before processing
	MinItems  int                 // minimum events required for valid results
	ErrorType string              // specific error type to filter for (empty = all errors)
	Count     int64               // number of failed events tracked
	Events    map[string]struct{} // event IDs indexed for deletion
	// contains filtered or unexported fields
}

StatREPFC counts requests where ReplyState is not "OK".

func (*StatREPFC) AddEvent added in v0.11.0

func (s *StatREPFC) AddEvent(evID string, ev utils.DataProvider) error

AddEvent processes a new event, incrementing count if ReplyState is not "OK".

func (*StatREPFC) AddOneEvent added in v0.11.0

func (s *StatREPFC) AddOneEvent(ev utils.DataProvider) error

AddOneEvent processes event without storing for removal (used when events never expire).

func (*StatREPFC) Clone added in v0.11.0

func (s *StatREPFC) Clone() StatMetric

Clone creates a deep copy of StatREPFC.

func (*StatREPFC) Compress added in v0.11.0

func (s *StatREPFC) Compress(queueLen int64, defaultID string, decimals int) []string

Compress is part of StatMetric interface.

func (*StatREPFC) GetCompressFactor added in v0.11.0

func (s *StatREPFC) GetCompressFactor(events map[string]int) map[string]int

func (*StatREPFC) GetFilterIDs added in v0.11.0

func (s *StatREPFC) GetFilterIDs() []string

GetFilterIDs is part of StatMetric interface.

func (*StatREPFC) GetFloat64Value added in v0.11.0

func (s *StatREPFC) GetFloat64Value(decimals int) float64

func (*StatREPFC) GetMinItems added in v0.11.0

func (s *StatREPFC) GetMinItems() int

GetMinItems returns the minimum items for the metric.

func (*StatREPFC) GetStringValue added in v0.11.0

func (s *StatREPFC) GetStringValue(decimals int) string

func (*StatREPFC) GetValue added in v0.11.0

func (s *StatREPFC) GetValue(decimals int) any

func (*StatREPFC) LoadMarshaled added in v0.11.0

func (s *StatREPFC) LoadMarshaled(ms Marshaler, marshaled []byte) error

func (*StatREPFC) Marshal added in v0.11.0

func (s *StatREPFC) Marshal(ms Marshaler) ([]byte, error)

func (*StatREPFC) RemEvent added in v0.11.0

func (s *StatREPFC) RemEvent(evID string)

type StatREPSC added in v0.11.0

type StatREPSC struct {
	FilterIDs []string            // event filters to apply before processing
	MinItems  int                 // minimum events required for valid results
	Count     int64               // number of successful events tracked
	Events    map[string]struct{} // event IDs indexed for deletion
	// contains filtered or unexported fields
}

StatREPSC counts requests where ReplyState equals "OK"

func (*StatREPSC) AddEvent added in v0.11.0

func (s *StatREPSC) AddEvent(evID string, ev utils.DataProvider) error

AddEvent processes a new event, incrementing count if ReplyState is "OK".

func (*StatREPSC) AddOneEvent added in v0.11.0

func (s *StatREPSC) AddOneEvent(ev utils.DataProvider) error

AddOneEvent processes event without storing for removal (used when events never expire).

func (*StatREPSC) Clone added in v0.11.0

func (s *StatREPSC) Clone() StatMetric

Clone creates a deep copy of StatREPSC.

func (*StatREPSC) Compress added in v0.11.0

func (s *StatREPSC) Compress(queueLen int64, defaultID string, decimals int) []string

Compress is part of StatMetric interface.

func (*StatREPSC) GetCompressFactor added in v0.11.0

func (s *StatREPSC) GetCompressFactor(events map[string]int) map[string]int

func (*StatREPSC) GetFilterIDs added in v0.11.0

func (s *StatREPSC) GetFilterIDs() []string

GetFilterIDs is part of StatMetric interface.

func (*StatREPSC) GetFloat64Value added in v0.11.0

func (s *StatREPSC) GetFloat64Value(decimals int) float64

func (*StatREPSC) GetMinItems added in v0.11.0

func (s *StatREPSC) GetMinItems() int

GetMinItems returns the minimum items for the metric.

func (*StatREPSC) GetStringValue added in v0.11.0

func (s *StatREPSC) GetStringValue(decimals int) string

func (*StatREPSC) GetValue added in v0.11.0

func (s *StatREPSC) GetValue(decimals int) any

func (*StatREPSC) LoadMarshaled added in v0.11.0

func (s *StatREPSC) LoadMarshaled(ms Marshaler, marshaled []byte) error

func (*StatREPSC) Marshal added in v0.11.0

func (s *StatREPSC) Marshal(ms Marshaler) ([]byte, error)

func (*StatREPSC) RemEvent added in v0.11.0

func (s *StatREPSC) RemEvent(evID string)

type StatService

type StatService struct {
	// contains filtered or unexported fields
}

StatService builds stats for events

func NewStatService

func NewStatService(dm *DataManager, cgrcfg *config.CGRConfig,
	filterS *FilterS, connMgr *ConnManager) *StatService

NewStatService initializes a StatService

func (*StatService) Reload

func (sS *StatService) Reload()

Reload restarts the backup loop. No-op after Shutdown.

func (*StatService) Shutdown

func (sS *StatService) Shutdown()

Shutdown is called to shutdown the service

func (*StatService) StartLoop

func (sS *StatService) StartLoop()

StartLoop starts the goroutine with the backup loop

func (*StatService) StoreStatQueue

func (sS *StatService) StoreStatQueue(sq *StatQueue) (err error)

StoreStatQueue stores the statQueue in DB and corrects dirty flag

func (*StatService) V1GetQueueFloatMetrics

func (sS *StatService) V1GetQueueFloatMetrics(ctx *context.Context, args *utils.TenantID, reply *map[string]float64) (err error)

V1GetQueueFloatMetrics returns the metrics as float64 values

func (*StatService) V1GetQueueIDs

func (sS *StatService) V1GetQueueIDs(ctx *context.Context, tenant string, qIDs *[]string) (err error)

V1GetQueueIDs returns list of queueIDs registered for a tenant

func (*StatService) V1GetQueueStringMetrics

func (sS *StatService) V1GetQueueStringMetrics(ctx *context.Context, args *utils.TenantID, reply *map[string]string) (err error)

V1GetQueueStringMetrics returns the metrics of a Queue as string values

func (*StatService) V1GetStatQueue added in v0.10.1

func (sS *StatService) V1GetStatQueue(ctx *context.Context, args *utils.TenantIDWithAPIOpts, reply *StatQueue) (err error)

V1GetStatQueue returns a StatQueue object

func (*StatService) V1GetStatQueuesForEvent

func (sS *StatService) V1GetStatQueuesForEvent(ctx *context.Context, args *utils.CGREvent, reply *[]string) (err error)

V1GetStatQueuesForEvent implements StatV1 method for processing an Event

func (*StatService) V1ProcessEvent

func (sS *StatService) V1ProcessEvent(ctx *context.Context, args *utils.CGREvent, reply *[]string) (err error)

V1ProcessEvent implements StatV1 method for processing an Event

func (*StatService) V1ResetStatQueue added in v0.11.0

func (sS *StatService) V1ResetStatQueue(ctx *context.Context, tntID *utils.TenantID, rply *string) (err error)

V1ResetStatQueue resets the stat queue

type StatSum

type StatSum struct {
	FilterIDs []string
	Sum       float64
	Count     int64
	Events    map[string]*StatWithCompress // map[EventTenantID]Cost
	MinItems  int
	Fields    config.RSRParsers
	// contains filtered or unexported fields
}

func (*StatSum) AddEvent

func (sum *StatSum) AddEvent(evID string, ev utils.DataProvider) (err error)

func (*StatSum) AddOneEvent added in v0.11.0

func (sum *StatSum) AddOneEvent(ev utils.DataProvider) (err error)

func (*StatSum) Clone added in v0.11.0

func (s *StatSum) Clone() StatMetric

Clone creates a deep copy of StatSum

func (*StatSum) Compress

func (sum *StatSum) Compress(queueLen int64, defaultID string, roundingDecimal int) (eventIDs []string)

Compress is part of StatMetric interface

func (*StatSum) GetCompressFactor

func (sum *StatSum) GetCompressFactor(events map[string]int) map[string]int

Compress is part of StatMetric interface

func (*StatSum) GetFilterIDs

func (sum *StatSum) GetFilterIDs() []string

GetFilterIDs is part of StatMetric interface

func (*StatSum) GetFloat64Value

func (sum *StatSum) GetFloat64Value(roundingDecimal int) (v float64)

func (*StatSum) GetMinItems added in v0.11.0

func (sum *StatSum) GetMinItems() (minIts int)

GetMinItems returns the minim items for the metric

func (*StatSum) GetStringValue

func (sum *StatSum) GetStringValue(roundingDecimal int) (valStr string)

func (*StatSum) GetValue

func (sum *StatSum) GetValue(roundingDecimal int) (v any)

func (*StatSum) LoadMarshaled

func (sum *StatSum) LoadMarshaled(ms Marshaler, marshaled []byte) (err error)

func (*StatSum) Marshal

func (sum *StatSum) Marshal(ms Marshaler) (marshaled []byte, err error)

func (*StatSum) RemEvent

func (sum *StatSum) RemEvent(evID string)

type StatTCC

type StatTCC struct {
	FilterIDs []string
	Sum       float64
	Count     int64
	Events    map[string]*StatWithCompress // map[EventTenantID]Cost
	MinItems  int
	// contains filtered or unexported fields
}

TCC implements TotalCallCost metric

func (*StatTCC) AddEvent

func (tcc *StatTCC) AddEvent(evID string, ev utils.DataProvider) (err error)

func (*StatTCC) AddOneEvent added in v0.11.0

func (tcc *StatTCC) AddOneEvent(ev utils.DataProvider) (err error)

func (*StatTCC) Clone added in v0.11.0

func (s *StatTCC) Clone() StatMetric

Clone creates a deep copy of StatTCC

func (*StatTCC) Compress

func (tcc *StatTCC) Compress(queueLen int64, defaultID string, roundingDecimal int) (eventIDs []string)

Compress is part of StatMetric interface

func (*StatTCC) GetCompressFactor

func (tcc *StatTCC) GetCompressFactor(events map[string]int) map[string]int

Compress is part of StatMetric interface

func (*StatTCC) GetFilterIDs

func (tcc *StatTCC) GetFilterIDs() []string

GetFilterIDs is part of StatMetric interface

func (*StatTCC) GetFloat64Value

func (tcc *StatTCC) GetFloat64Value(roundingDecimal int) (v float64)

func (*StatTCC) GetMinItems added in v0.11.0

func (tcc *StatTCC) GetMinItems() (minIts int)

GetMinItems returns the minim items for the metric

func (*StatTCC) GetStringValue

func (tcc *StatTCC) GetStringValue(roundingDecimal int) (valStr string)

func (*StatTCC) GetValue

func (tcc *StatTCC) GetValue(roundingDecimal int) (v any)

func (*StatTCC) LoadMarshaled

func (tcc *StatTCC) LoadMarshaled(ms Marshaler, marshaled []byte) (err error)

func (*StatTCC) Marshal

func (tcc *StatTCC) Marshal(ms Marshaler) (marshaled []byte, err error)

func (*StatTCC) RemEvent

func (tcc *StatTCC) RemEvent(evID string)

type StatTCD

type StatTCD struct {
	FilterIDs []string
	Sum       time.Duration
	Count     int64
	Events    map[string]*DurationWithCompress // map[EventTenantID]Duration
	MinItems  int
	// contains filtered or unexported fields
}

TCD implements TotalCallDuration metric

func (*StatTCD) AddEvent

func (tcd *StatTCD) AddEvent(evID string, ev utils.DataProvider) (err error)

func (*StatTCD) AddOneEvent added in v0.11.0

func (tcd *StatTCD) AddOneEvent(ev utils.DataProvider) (err error)

func (*StatTCD) Clone added in v0.11.0

func (s *StatTCD) Clone() StatMetric

Clone creates a deep copy of StatTCD

func (*StatTCD) Compress

func (tcd *StatTCD) Compress(queueLen int64, defaultID string, roundingDecimal int) (eventIDs []string)

Compress is part of StatMetric interface

func (*StatTCD) GetCompressFactor

func (tcd *StatTCD) GetCompressFactor(events map[string]int) map[string]int

Compress is part of StatMetric interface

func (*StatTCD) GetFilterIDs

func (tcd *StatTCD) GetFilterIDs() []string

GetFilterIDs is part of StatMetric interface

func (*StatTCD) GetFloat64Value

func (tcd *StatTCD) GetFloat64Value(roundingDecimal int) (v float64)

func (*StatTCD) GetMinItems added in v0.11.0

func (tcd *StatTCD) GetMinItems() (minIts int)

GetMinItems returns the minim items for the metric

func (*StatTCD) GetStringValue

func (tcd *StatTCD) GetStringValue(roundingDecimal int) (valStr string)

func (*StatTCD) GetValue

func (tcd *StatTCD) GetValue(roundingDecimal int) (v any)

func (*StatTCD) LoadMarshaled

func (tcd *StatTCD) LoadMarshaled(ms Marshaler, marshaled []byte) (err error)

func (*StatTCD) Marshal

func (tcd *StatTCD) Marshal(ms Marshaler) (marshaled []byte, err error)

func (*StatTCD) RemEvent

func (tcd *StatTCD) RemEvent(evID string)

type StatWithCompress

type StatWithCompress struct {
	Stat           float64
	CompressFactor int
}

ACDHelper structure

func (*StatWithCompress) Clone added in v0.11.0

func (swc *StatWithCompress) Clone() *StatWithCompress

Clone creates a deep copy of StatWithCompress

type StorDB

type StorDB interface {
	CdrStorage
	LoadReader
	LoadWriter
}

func NewStorDBConn

func NewStorDBConn(dbType, host, port, name, user, pass, marshaler string,
	stringIndexedFields, prefixIndexedFields []string,
	opts *config.StorDBOpts, itmsCfg map[string]*config.ItemOpt) (db StorDB, err error)

NewStorDBConn returns a StorDB(implements Storage interface) based on dbType

type Storage

type Storage interface {
	Close()
	Flush(string) error
	GetKeysForPrefix(string, string) ([]string, error)
	RemoveKeysForPrefix(string) error
	GetVersions(itm string) (vrs Versions, err error)
	SetVersions(vrs Versions, overwrite bool) (err error)
	RemoveVersions(vrs Versions) (err error)
	GetStorageType() string
	IsDBEmpty() (resp bool, err error)
}

type StoredSRun added in v0.11.0

type StoredSRun struct {
	Event     MapEvent        // Event received from ChargerS
	CD        *CallDescriptor // initial CD used for debits, updated on each debit
	EventCost *EventCost

	ExtraDuration time.Duration // keeps the current duration debited on top of what has been asked
	LastUsage     time.Duration // last requested Duration
	TotalUsage    time.Duration // sum of lastUsage
	NextAutoDebit *time.Time
}

used to evade import cycle of the real sessions.SRun struct

type StoredSession added in v0.11.0

type StoredSession struct {
	CGRID         string
	Tenant        string
	IPAllocID     string
	ResourceID    string
	ClientConnID  string        // connection ID towards the client so we can recover from passive
	EventStart    MapEvent      // Event which started the session
	DebitInterval time.Duration // execute debits for *prepaid runs
	Chargeable    bool          // used in case of pausing debit
	SRuns         []*StoredSRun // forked based on ChargerS
	OptsStart     MapEvent
	UpdatedAt     time.Time // time when session was changed
}

Holds a Session for storing in DataDB

type StoredStatQueue

type StoredStatQueue struct {
	Tenant     string
	ID         string
	SQItems    []SQItem
	SQMetrics  map[string][]byte
	Compressed bool
}

StoredStatQueue differs from StatQueue due to serialization of SQMetrics

func NewStoredStatQueue

func NewStoredStatQueue(sq *StatQueue, ms Marshaler) (sSQ *StoredStatQueue, err error)

NewStoredStatQueue initiates a StoredStatQueue out of StatQueue

func (*StoredStatQueue) AsStatQueue

func (ssq *StoredStatQueue) AsStatQueue(ms Marshaler) (sq *StatQueue, err error)

AsStatQueue converts into StatQueue unmarshaling SQMetrics

func (*StoredStatQueue) SqID

func (ssq *StoredStatQueue) SqID() string

SqID will compose the unique identifier for the StatQueue out of Tenant and ID

type SureTaxRequest

type SureTaxRequest struct {
	Request string `json:"request"` // SureTax Requires us to encapsulate the content into a request element
}

SureTax JSON Request

func NewSureTaxRequest

func NewSureTaxRequest(cdr *CDR, stCfg *config.SureTaxCfg) (*SureTaxRequest, error)

Init a new request to be sent out to SureTax

type SureTaxResponse

type SureTaxResponse struct {
	D string // SureTax requires encapsulating reply into a D object
}

SureTax JSON Response

type TBLVersion

type TBLVersion struct {
	ID      uint
	Item    string
	Version int64
}

func (TBLVersion) TableName

func (t TBLVersion) TableName() string

type TPCSVImporter

type TPCSVImporter struct {
	TPid     string     // Load data on this tpid
	StorDb   LoadWriter // StorDb connection handle
	DirPath  string     // Directory path to import from
	Sep      rune       // Separator in the csv file
	Verbose  bool       // If true will print a detailed information instead of silently discarding it
	ImportId string     // Use this to differentiate between imports (eg: when autogenerating fields like RatingProfileID
	// contains filtered or unexported fields
}

Import tariff plan from csv into storDb

func (*TPCSVImporter) Run

func (tpImp *TPCSVImporter) Run() error

type TPExporter

type TPExporter struct {
	// contains filtered or unexported fields
}

Export TariffPlan to a folder

func NewTPExporter

func NewTPExporter(storDb LoadStorage, tpID, expPath, fileFormat, sep string, compress bool) (*TPExporter, error)

func (*TPExporter) ExportStats

func (tpExp *TPExporter) ExportStats() *utils.ExportedTPStats

func (*TPExporter) GetCacheBuffer

func (tpExp *TPExporter) GetCacheBuffer() *bytes.Buffer

func (*TPExporter) Run

func (tpExp *TPExporter) Run() error

type Task

type Task struct {
	Uuid      string
	AccountID string
	ActionsID string
}

Task is a one time action executed by the scheduler

func (*Task) Execute

func (t *Task) Execute(fltrS *FilterS) error

func (*Task) FieldAsInterface

func (t *Task) FieldAsInterface(fldPath []string) (iface any, err error)

FieldAsInterface implements utils.DataProvider ToDo: support Action fields

func (*Task) FieldAsString

func (t *Task) FieldAsString(fldPath []string) (s string, err error)

FieldAsString implements utils.DataProvider ToDo: support Action fields

func (*Task) String

func (t *Task) String() string

String implements utils.DataProvider

type TenantRatingSubject

type TenantRatingSubject struct {
	Tenant, Subject string
}

type Threshold

type Threshold struct {
	Tenant string
	ID     string
	Hits   int       // number of hits for this threshold
	Snooze time.Time // prevent threshold to run too early
	// contains filtered or unexported fields
}

Threshold is the unit matched by filters

func (*Threshold) CacheClone added in v0.11.0

func (t *Threshold) CacheClone() any

CacheClone returns a clone of Threshold used by ltcache CacheCloner

func (*Threshold) Clone added in v0.11.0

func (t *Threshold) Clone() *Threshold

Clone clones *Threshold (lkID excluded)

func (*Threshold) TenantID

func (t *Threshold) TenantID() string

TenantID returns the concatenated key beteen tenant and ID

type ThresholdConfig added in v0.11.0

type ThresholdConfig struct {
	FilterIDs          []string
	ActivationInterval *utils.ActivationInterval
	MaxHits            int
	MinHits            int
	MinSleep           time.Duration
	Blocker            bool
	Weight             float64
	ActionIDs          []string
	Async              bool
	EeIDs              []string
}

type ThresholdMdl added in v0.11.0

type ThresholdMdl struct {
	PK                 uint `gorm:"primary_key"`
	Tpid               string
	Tenant             string  `index:"0" re:".*"`
	ID                 string  `index:"1" re:".*"`
	FilterIDs          string  `index:"2" re:".*"`
	ActivationInterval string  `index:"3" re:".*"`
	MaxHits            int     `index:"4" re:".*"`
	MinHits            int     `index:"5" re:".*"`
	MinSleep           string  `index:"6" re:".*"`
	Blocker            bool    `index:"7" re:".*"`
	Weight             float64 `index:"8" re:".*"`
	ActionIDs          string  `index:"9" re:".*"`
	Async              bool    `index:"10" re:".*"`
	EeIDs              string  `index:"11"  re:".*"`

	CreatedAt time.Time
}

func (ThresholdMdl) TableName added in v0.11.0

func (ThresholdMdl) TableName() string

type ThresholdMdls added in v0.11.0

type ThresholdMdls []*ThresholdMdl

func APItoModelTPThreshold

func APItoModelTPThreshold(th *utils.TPThresholdProfile) (mdls ThresholdMdls)

func (ThresholdMdls) AsTPThreshold added in v0.11.0

func (tps ThresholdMdls) AsTPThreshold() (result []*utils.TPThresholdProfile)

func (ThresholdMdls) CSVHeader added in v0.11.0

func (tps ThresholdMdls) CSVHeader() (result []string)

CSVHeader return the header for csv fields as a slice of string

type ThresholdProfile

type ThresholdProfile struct {
	Tenant             string
	ID                 string
	FilterIDs          []string
	ActivationInterval *utils.ActivationInterval // Time when this limit becomes active and expires
	MaxHits            int
	MinHits            int
	MinSleep           time.Duration
	Blocker            bool    // blocker flag to stop processing on filters matched
	Weight             float64 // Weight to sort the thresholds
	ActionIDs          []string
	Async              bool
	EeIDs              []string
	// contains filtered or unexported fields
}

ThresholdProfile the profile for threshold

func APItoThresholdProfile

func APItoThresholdProfile(tpTH *utils.TPThresholdProfile, timezone string) (th *ThresholdProfile, err error)

func (*ThresholdProfile) CacheClone added in v0.11.0

func (tp *ThresholdProfile) CacheClone() any

CacheClone returns a clone of ThresholdProfile used by ltcache CacheCloner

func (*ThresholdProfile) Clone added in v0.11.0

func (tp *ThresholdProfile) Clone() *ThresholdProfile

Clone clones *ThresholdProfile (lkID excluded)

func (*ThresholdProfile) TenantID

func (tp *ThresholdProfile) TenantID() string

TenantID returns the concatenated key beteen tenant and ID

type ThresholdProfileWithAPIOpts added in v0.11.0

type ThresholdProfileWithAPIOpts struct {
	*ThresholdProfile
	APIOpts map[string]any
}

ThresholdProfileWithAPIOpts is used in replicatorV1 for dispatcher

type ThresholdService

type ThresholdService struct {
	// contains filtered or unexported fields
}

ThresholdService manages Threshold execution and storing them to dataDB

func NewThresholdService

func NewThresholdService(dm *DataManager, cgrcfg *config.CGRConfig, filterS *FilterS, conn *ConnManager) *ThresholdService

NewThresholdService the constructor for ThresoldS service

func (*ThresholdService) BiRPCv1RegisterInternalBiJSONConn added in v0.11.0

func (tS *ThresholdService) BiRPCv1RegisterInternalBiJSONConn(ctx *context.Context,
	connID string, reply *string) error

BiRPCv1RegisterInternalBiJSONConn will register the internal BiRPC connection towards ThresholdS

func (*ThresholdService) BiRPCv1RemoveClientConnID added in v0.11.0

func (tS *ThresholdService) BiRPCv1RemoveClientConnID(ctx *context.Context,
	args string, reply *string) error

BiRPCv1RemoveClientConnID will remove the args ClientConnID from the list of SyConnIds on the ThresholdService

func (*ThresholdService) BiRPCv1StoreClientConnID added in v0.11.0

func (tS *ThresholdService) BiRPCv1StoreClientConnID(ctx *context.Context,
	args *utils.SyConnIDs, reply *string) error

BiRPCv1StoreClientConnID will create a ClientConnID and store it in relation to the threshold profile ID it represents

func (*ThresholdService) OnBiJSONConnect added in v0.11.0

func (tS *ThresholdService) OnBiJSONConnect(c birpc.ClientConnector)

OnBiJSONConnect handles new client connections.

func (*ThresholdService) OnBiJSONDisconnect added in v0.11.0

func (tS *ThresholdService) OnBiJSONDisconnect(c birpc.ClientConnector)

OnBiJSONDisconnect handles client disconnects

func (*ThresholdService) Reload

func (tS *ThresholdService) Reload()

Reload restarts the backup loop. No-op after Shutdown.

func (*ThresholdService) Shutdown

func (tS *ThresholdService) Shutdown()

Shutdown is called to shutdown the service

func (*ThresholdService) StartLoop

func (tS *ThresholdService) StartLoop()

StartLoop starts the goroutine with the backup loop

func (*ThresholdService) StoreThreshold

func (tS *ThresholdService) StoreThreshold(t *Threshold) (err error)

StoreThreshold stores the threshold in DB and corrects dirty flag

func (*ThresholdService) V1GetThreshold

func (tS *ThresholdService) V1GetThreshold(ctx *context.Context, tntID *utils.TenantID, t *Threshold) (err error)

V1GetThreshold retrieves a Threshold

func (*ThresholdService) V1GetThresholdIDs

func (tS *ThresholdService) V1GetThresholdIDs(ctx *context.Context, tenant string, tIDs *[]string) (err error)

V1GetThresholdIDs returns list of thresholdIDs configured for a tenant

func (*ThresholdService) V1GetThresholdsForEvent

func (tS *ThresholdService) V1GetThresholdsForEvent(ctx *context.Context, args *utils.CGREvent, reply *Thresholds) (err error)

V1GetThresholdsForEvent queries thresholds matching an Event

func (*ThresholdService) V1ProcessEvent

func (tS *ThresholdService) V1ProcessEvent(ctx *context.Context, args *utils.CGREvent, reply *[]string) (err error)

V1ProcessEvent implements ThresholdService method for processing an Event

func (*ThresholdService) V1ResetThreshold added in v0.11.0

func (tS *ThresholdService) V1ResetThreshold(ctx *context.Context, tntID *utils.TenantID, rply *string) (err error)

V1ResetThreshold resets the threshold hits If the threshold does not exist (e.g., removed after MaxHits), it attempts to recreate it based on its ThresholdProfile.

type ThresholdWithAPIOpts added in v0.11.0

type ThresholdWithAPIOpts struct {
	*Threshold
	APIOpts map[string]any
}

ThresholdWithAPIOpts is used in replicatorV1 for dispatcher

type Thresholds

type Thresholds []*Threshold

Thresholds is a sortable slice of Threshold

func (Thresholds) Sort

func (ts Thresholds) Sort()

Sort sorts based on Weight

type TimeSpan

type TimeSpan struct {
	TimeStart      time.Time
	TimeEnd        time.Time
	Cost           float64
	RateInterval   *RateInterval
	DurationIndex  time.Duration // the call duration so far till TimeEnd
	Increments     Increments
	RoundIncrement *Increment
	MatchedSubject string
	MatchedPrefix  string
	MatchedDestId  string
	RatingPlanId   string
	CompressFactor int
	// contains filtered or unexported fields
}

A unit in which a call will be split that has a specific price related interval attached to it.

func (*TimeSpan) CalculateCost

func (ts *TimeSpan) CalculateCost() float64

Returns the cost of the timespan according to the relevant cost interval. It also sets the Cost field of this timespan (used for refund on session manager debit loop where the cost cannot be recalculated)

func (*TimeSpan) Contains

func (ts *TimeSpan) Contains(t time.Time) bool

Returns true if the given time is inside timespan range.

func (*TimeSpan) Equal

func (ts *TimeSpan) Equal(other *TimeSpan) bool

func (*TimeSpan) GetCompressFactor

func (ts *TimeSpan) GetCompressFactor() int

func (*TimeSpan) GetDuration

func (ts *TimeSpan) GetDuration() time.Duration

Returns the duration of the timespan

func (*TimeSpan) GetGroupEnd

func (ts *TimeSpan) GetGroupEnd() time.Duration

func (*TimeSpan) GetGroupStart

func (ts *TimeSpan) GetGroupStart() time.Duration

Returns the starting time of this timespan

func (*TimeSpan) GetTimeStartForIncrement

func (ts *TimeSpan) GetTimeStartForIncrement(index int) time.Time

returns a time for the specified second in the time span

func (*TimeSpan) GetUnitCost

func (ts *TimeSpan) GetUnitCost() float64

func (*TimeSpan) GetUnitDuration

func (ts *TimeSpan) GetUnitDuration() time.Duration

Returns the duration of a unitary timespan in a compressed set

func (*TimeSpan) Merge

func (ts *TimeSpan) Merge(other *TimeSpan) bool

Merges timespans if they share the same charging signature, useful to run in SM before compressing

func (*TimeSpan) RoundToDuration

func (ts *TimeSpan) RoundToDuration(duration time.Duration)

func (*TimeSpan) SetNewDurationIndex

func (ts *TimeSpan) SetNewDurationIndex(nts *TimeSpan)

sets the DurationIndex attribute to reflect new timespan

func (*TimeSpan) SetRateInterval

func (ts *TimeSpan) SetRateInterval(interval *RateInterval)

func (*TimeSpan) SharingSignature

func (ts *TimeSpan) SharingSignature(other *TimeSpan) bool

Estimate if they share charging signature

func (*TimeSpan) SplitByDay

func (ts *TimeSpan) SplitByDay() (newTs *TimeSpan)

Splits the given timespan on activation period's activation time.

func (*TimeSpan) SplitByDuration

func (ts *TimeSpan) SplitByDuration(duration time.Duration) *TimeSpan

Split the timespan at the given second

func (*TimeSpan) SplitByIncrement

func (ts *TimeSpan) SplitByIncrement(index int) (newTs *TimeSpan)

Split the timespan at the given increment start

func (*TimeSpan) SplitByRateInterval

func (ts *TimeSpan) SplitByRateInterval(i *RateInterval, data bool) (nts *TimeSpan)

Splits the given timespan according to how it relates to the interval. It will modify the endtime of the received timespan and it will return a new timespan starting from the end of the received one. The interval will attach itself to the timespan that overlaps the interval.

func (*TimeSpan) SplitByRatingPlan

func (ts *TimeSpan) SplitByRatingPlan(rp *RatingInfo) (newTs *TimeSpan)

Splits the given timespan on activation period's activation time.

type TimeSpans

type TimeSpans []*TimeSpan

func (*TimeSpans) Compress

func (tss *TimeSpans) Compress()

func (*TimeSpans) Decompress

func (tss *TimeSpans) Decompress()

func (*TimeSpans) Merge

func (tss *TimeSpans) Merge()

func (*TimeSpans) OverlapWithTimeSpans

func (timespans *TimeSpans) OverlapWithTimeSpans(paidTs TimeSpans, newTs *TimeSpan, index int) bool

The paidTs will replace the timespans that are exactly `under` them from the reciver list

func (*TimeSpans) RemoveOverlapedFromIndex

func (timespans *TimeSpans) RemoveOverlapedFromIndex(index int)

Will delete all timespans that are `under` the timespan at index

type TimingMdl added in v0.11.0

type TimingMdl struct {
	Id        int64
	Tpid      string
	Tag       string `index:"0" re:".*"`
	Years     string `index:"1" re:".*"`
	Months    string `index:"2" re:".*"`
	MonthDays string `index:"3" re:".*"`
	WeekDays  string `index:"4" re:".*"`
	Time      string `index:"5" re:".*"`
	CreatedAt time.Time
}

func APItoModelTiming

func APItoModelTiming(t *utils.ApierTPTiming) (result TimingMdl)

func (TimingMdl) TableName added in v0.11.0

func (TimingMdl) TableName() string

type TimingMdls added in v0.11.0

type TimingMdls []TimingMdl

func APItoModelTimings

func APItoModelTimings(ts []*utils.ApierTPTiming) (result TimingMdls)

func (TimingMdls) AsMapTPTimings added in v0.11.0

func (tps TimingMdls) AsMapTPTimings() (map[string]*utils.ApierTPTiming, error)

func (TimingMdls) AsTPTimings added in v0.11.0

func (tps TimingMdls) AsTPTimings() (result []*utils.ApierTPTiming)

type TpReader

type TpReader struct {
	// contains filtered or unexported fields
}

func NewTpReader

func NewTpReader(dm *DataManager, lr LoadReader, tpid, timezone string,
	cacheConns, schedulerConns []string) (*TpReader, error)

func (*TpReader) GetLoadedIds

func (tpr *TpReader) GetLoadedIds(categ string) ([]string, error)

GetLoadedIds returns the identities loaded for a specific category, useful for cache reloads

func (*TpReader) Init

func (tpr *TpReader) Init()

func (*TpReader) IsValid

func (tpr *TpReader) IsValid() (valid bool)

func (*TpReader) LoadAccountActions

func (tpr *TpReader) LoadAccountActions() (err error)

func (*TpReader) LoadAccountActionsFiltered

func (tpr *TpReader) LoadAccountActionsFiltered(qriedAA *utils.TPAccountActions) error

func (*TpReader) LoadActionPlans

func (tpr *TpReader) LoadActionPlans() (err error)

func (*TpReader) LoadActionTriggers

func (tpr *TpReader) LoadActionTriggers() (err error)

func (*TpReader) LoadActions

func (tpr *TpReader) LoadActions() (err error)

func (*TpReader) LoadAll

func (tpr *TpReader) LoadAll() (err error)

func (*TpReader) LoadAttributeProfiles

func (tpr *TpReader) LoadAttributeProfiles() error

func (*TpReader) LoadAttributeProfilesFiltered

func (tpr *TpReader) LoadAttributeProfilesFiltered(tag string) (err error)

func (*TpReader) LoadChargerProfiles

func (tpr *TpReader) LoadChargerProfiles() error

func (*TpReader) LoadChargerProfilesFiltered

func (tpr *TpReader) LoadChargerProfilesFiltered(tag string) (err error)

func (*TpReader) LoadDestinationRates

func (tpr *TpReader) LoadDestinationRates() (err error)

func (*TpReader) LoadDestinations

func (tpr *TpReader) LoadDestinations() (err error)

func (*TpReader) LoadDestinationsFiltered

func (tpr *TpReader) LoadDestinationsFiltered(tag string) (bool, error)

func (*TpReader) LoadDispatcherHosts

func (tpr *TpReader) LoadDispatcherHosts() error

func (*TpReader) LoadDispatcherHostsFiltered

func (tpr *TpReader) LoadDispatcherHostsFiltered(tag string) (err error)

func (*TpReader) LoadDispatcherProfiles

func (tpr *TpReader) LoadDispatcherProfiles() error

func (*TpReader) LoadDispatcherProfilesFiltered

func (tpr *TpReader) LoadDispatcherProfilesFiltered(tag string) (err error)

func (*TpReader) LoadFilters

func (tpr *TpReader) LoadFilters() error

func (*TpReader) LoadFiltersFiltered

func (tpr *TpReader) LoadFiltersFiltered(tag string) error

func (*TpReader) LoadIPProfiles added in v0.11.0

func (tpr *TpReader) LoadIPProfiles() error

func (*TpReader) LoadIPProfilesFiltered added in v0.11.0

func (tpr *TpReader) LoadIPProfilesFiltered(tag string) (err error)

func (*TpReader) LoadRankings added in v0.11.0

func (tpr *TpReader) LoadRankings() error

func (*TpReader) LoadRankingsFiltered added in v0.11.0

func (tpr *TpReader) LoadRankingsFiltered(tag string) error

func (*TpReader) LoadRates

func (tpr *TpReader) LoadRates() (err error)

func (*TpReader) LoadRatingPlans

func (tpr *TpReader) LoadRatingPlans() (err error)

func (*TpReader) LoadRatingPlansFiltered

func (tpr *TpReader) LoadRatingPlansFiltered(tag string) (bool, error)

LoadRatingPlansFiltered returns true, nil in case of load success, false, nil in case of RatingPlan not found dataStorage

func (*TpReader) LoadRatingProfiles

func (tpr *TpReader) LoadRatingProfiles() (err error)

func (*TpReader) LoadRatingProfilesFiltered

func (tpr *TpReader) LoadRatingProfilesFiltered(qriedRpf *utils.TPRatingProfile) error

func (*TpReader) LoadResourceProfiles

func (tpr *TpReader) LoadResourceProfiles() error

func (*TpReader) LoadResourceProfilesFiltered

func (tpr *TpReader) LoadResourceProfilesFiltered(tag string) (err error)

func (*TpReader) LoadRouteProfiles added in v0.11.0

func (tpr *TpReader) LoadRouteProfiles() error

func (*TpReader) LoadRouteProfilesFiltered added in v0.11.0

func (tpr *TpReader) LoadRouteProfilesFiltered(tag string) (err error)

func (*TpReader) LoadSharedGroups

func (tpr *TpReader) LoadSharedGroups() error

func (*TpReader) LoadSharedGroupsFiltered

func (tpr *TpReader) LoadSharedGroupsFiltered(tag string, save bool) (err error)

func (*TpReader) LoadStats

func (tpr *TpReader) LoadStats() error

func (*TpReader) LoadStatsFiltered

func (tpr *TpReader) LoadStatsFiltered(tag string) (err error)

func (*TpReader) LoadThresholds

func (tpr *TpReader) LoadThresholds() error

func (*TpReader) LoadThresholdsFiltered

func (tpr *TpReader) LoadThresholdsFiltered(tag string) (err error)

func (*TpReader) LoadTimings

func (tpr *TpReader) LoadTimings() (err error)

func (*TpReader) LoadTrends added in v0.11.0

func (tpr *TpReader) LoadTrends() error

func (*TpReader) LoadTrendsFiltered added in v0.11.0

func (tpr *TpReader) LoadTrendsFiltered(tag string) error

func (*TpReader) ReloadCache

func (tpr *TpReader) ReloadCache(caching string, verbose bool, opts map[string]any, tenant string) (err error)

func (*TpReader) ReloadScheduler

func (tpr *TpReader) ReloadScheduler(verbose bool) (err error)

func (*TpReader) RemoveFromDatabase

func (tpr *TpReader) RemoveFromDatabase(verbose, disableReverse bool) (err error)

func (*TpReader) ShowStatistics

func (tpr *TpReader) ShowStatistics()

func (*TpReader) WriteToDatabase

func (tpr *TpReader) WriteToDatabase(verbose, disableReverse bool) (err error)

type Trend added in v0.11.0

type Trend struct {
	Tenant            string
	ID                string
	RunTimes          []time.Time
	Metrics           map[time.Time]map[string]*MetricWithTrend
	CompressedMetrics []byte // if populated, Metrics and RunTimes will be emty
	// contains filtered or unexported fields
}

Trend is the unit matched by filters

func NewTrendFromProfile added in v0.11.0

func NewTrendFromProfile(tP *TrendProfile) *Trend

NewTrendFromProfile is a constructor for an empty trend out of it's profile

func (*Trend) CacheClone added in v0.11.0

func (t *Trend) CacheClone() any

CacheClone returns a clone of Trend used by ltcache CacheCloner

func (*Trend) Clone added in v0.11.0

func (t *Trend) Clone() (tC *Trend)

func (*Trend) Compile added in v0.11.0

func (t *Trend) Compile(cleanTtl time.Duration, qLength int)

Compile is used to initialize or cleanup the Trend

thread safe since it should be used close to source

func (*Trend) TenantID added in v0.11.0

func (tr *Trend) TenantID() string

type TrendProfile added in v0.11.0

type TrendProfile struct {
	Tenant          string
	ID              string
	Schedule        string // Cron expression scheduling gathering of the metrics
	StatID          string
	Metrics         []string
	TTL             time.Duration
	QueueLength     int
	MinItems        int     // minimum number of items for building Trends
	CorrelationType string  // *last, *average
	Tolerance       float64 // allow this deviation margin for *constant trend
	Stored          bool    // store the Trend in dataDB
	ThresholdIDs    []string
}

A TrendProfile represents the settings of a Trend

func APItoTrends added in v0.11.0

func APItoTrends(tpTR *utils.TPTrendsProfile) (tr *TrendProfile, err error)

func (*TrendProfile) CacheClone added in v0.11.0

func (tP *TrendProfile) CacheClone() any

CacheClone returns a clone of TrendProfile used by ltcache CacheCloner

func (*TrendProfile) Clone added in v0.11.0

func (tP *TrendProfile) Clone() (clnTp *TrendProfile)

Clone will clone the TrendProfile so it can be used by scheduler safely

func (*TrendProfile) TenantID added in v0.11.0

func (srp *TrendProfile) TenantID() string

type TrendProfileWithAPIOpts added in v0.11.0

type TrendProfileWithAPIOpts struct {
	*TrendProfile
	APIOpts map[string]any
}
type TrendS struct {
	// contains filtered or unexported fields
}

TrendS is responsible of implementing the logic of TrendService

func NewTrendS added in v0.11.0

func NewTrendS(dm *DataManager,
	connMgr *ConnManager,
	filterS *FilterS,
	cgrcfg *config.CGRConfig) *TrendS

NewTrendS is the constructor for TrendS

func (*TrendS) Reload added in v0.11.0

func (tS *TrendS) Reload()

func (*TrendS) StartTrendS added in v0.11.0

func (tS *TrendS) StartTrendS() error

StartCron will activates the Cron, together with all scheduled Trend queries

func (*TrendS) StopTrendS added in v0.11.0

func (tS *TrendS) StopTrendS()

StopCron will shutdown the Cron tasks

func (*TrendS) V1GetScheduledTrends added in v0.11.0

func (tS *TrendS) V1GetScheduledTrends(ctx *context.Context, args *utils.ArgScheduledTrends, schedTrends *[]utils.ScheduledTrend) (err error)

func (*TrendS) V1GetTrend added in v0.11.0

func (tS *TrendS) V1GetTrend(ctx *context.Context, arg *utils.ArgGetTrend, retTrend *Trend) (err error)

V1GetTrend is the API to return the trend Metrics The number of runTimes can be filtered based on indexes and times provided as arguments

in this way being possible to work with paginators

func (*TrendS) V1GetTrendSummary added in v0.11.0

func (tS *TrendS) V1GetTrendSummary(ctx *context.Context, arg utils.TenantIDWithAPIOpts, reply *TrendSummary) (err error)

func (*TrendS) V1ScheduleQueries added in v0.11.0

func (tS *TrendS) V1ScheduleQueries(ctx *context.Context, args *utils.ArgScheduleTrendQueries, scheduled *int) (err error)

V1ScheduleQueries is the query for manually re-/scheduling Trend Queries

type TrendSummary added in v0.11.0

type TrendSummary struct {
	Tenant  string
	ID      string
	Time    time.Time
	Metrics map[string]*MetricWithTrend
}

TrendSummary represents the last trend computed

type TrendWithAPIOpts added in v0.11.0

type TrendWithAPIOpts struct {
	*Trend
	APIOpts map[string]any
}

type TrendsMdl added in v0.11.0

type TrendsMdl struct {
	PK              uint `gorm:"primary_key"`
	Tpid            string
	Tenant          string  `index:"0" re:".*"`
	ID              string  `index:"1" re:".*"`
	Schedule        string  `index:"2" re:".*"`
	StatID          string  `index:"3" re:".*"`
	Metrics         string  `index:"4" re:".*"`
	TTL             string  `index:"5" re:".*"`
	QueueLength     int     `index:"6" re:".*"`
	MinItems        int     `index:"7" re:".*"`
	CorrelationType string  `index:"8" re:".*"`
	Tolerance       float64 `index:"9"  re:".*"`
	Stored          bool    `index:"10" re:".*"`
	ThresholdIDs    string  `index:"11" re:".*"`
	CreatedAt       time.Time
}

func (TrendsMdl) TableName added in v0.11.0

func (TrendsMdl) TableName() string

type TrendsMdls added in v0.11.0

type TrendsMdls []*TrendsMdl

func APItoModelTrends added in v0.11.0

func APItoModelTrends(tr *utils.TPTrendsProfile) (mdls TrendsMdls)

func (TrendsMdls) AsTPTrends added in v0.11.0

func (models TrendsMdls) AsTPTrends() (result []*utils.TPTrendsProfile)

func (TrendsMdls) CSVHeader added in v0.11.0

func (tps TrendsMdls) CSVHeader() (result []string)

type UnitCounter

type UnitCounter struct {
	CounterType string         // *event or *balance
	Counters    CounterFilters // first balance is the general one (no destination)
}

Amount of a trafic of a certain type

func (*UnitCounter) Clone

func (uc *UnitCounter) Clone() (newUnit *UnitCounter)

Clone clones *UnitCounter

func (*UnitCounter) CopyCounterValues

func (uc *UnitCounter) CopyCounterValues(oldUc *UnitCounter) bool

Returns true if the counters were of the same type Copies the value from old balances

func (*UnitCounter) FieldAsInterface added in v0.11.0

func (uc *UnitCounter) FieldAsInterface(fldPath []string) (val any, err error)

func (*UnitCounter) FieldAsString added in v0.11.0

func (uc *UnitCounter) FieldAsString(fldPath []string) (val string, err error)

func (*UnitCounter) String added in v0.11.0

func (uc *UnitCounter) String() string

type UnitCounters

type UnitCounters map[string][]*UnitCounter

func (UnitCounters) Clone

func (ucs UnitCounters) Clone() UnitCounters

Clone clones UnitCounters

type UnitInfo

type UnitInfo struct {
	UUID          string
	ID            string
	Value         float64
	DestinationID string
	Consumed      float64
	Factor        float64
	Category      string
	ToR           string
	RateInterval  *RateInterval
}

func (*UnitInfo) Clone

func (ui *UnitInfo) Clone() *UnitInfo

func (*UnitInfo) Equal

func (ui *UnitInfo) Equal(other *UnitInfo) bool

type UsageRecord

type UsageRecord struct {
	ToR         string
	RequestType string
	Tenant      string
	Category    string
	Account     string
	Subject     string
	Destination string
	SetupTime   string
	AnswerTime  string
	Usage       string
	ExtraFields map[string]string
}

UsageRecord is used when authorizing requests from outside, eg APIerSv1.GetMaxUsage

func (*UsageRecord) AsCallDescriptor

func (uR *UsageRecord) AsCallDescriptor(timezone string, denyNegative bool) (*CallDescriptor, error)

func (*UsageRecord) GetId

func (uR *UsageRecord) GetId() string

type UsageRecordWithAPIOpts added in v0.11.0

type UsageRecordWithAPIOpts struct {
	*UsageRecord
	APIOpts map[string]any
}

type V2SMCost

type V2SMCost struct {
	CGRID       string
	RunID       string
	OriginHost  string
	OriginID    string
	CostSource  string
	Usage       time.Duration
	CostDetails *EventCost
}

type ValueFactors added in v0.11.0

type ValueFactors map[string]float64

func (ValueFactors) FieldAsInterface added in v0.11.0

func (f ValueFactors) FieldAsInterface(fldPath []string) (val any, err error)

func (ValueFactors) FieldAsString added in v0.11.0

func (f ValueFactors) FieldAsString(fldPath []string) (val string, err error)

func (ValueFactors) GetValue added in v0.11.0

func (f ValueFactors) GetValue(category string) float64

func (ValueFactors) String added in v0.11.0

func (f ValueFactors) String() string

type Versions

type Versions map[string]int64 // map[item]versionNr

Versions will keep trac of various item versions

func CurrentAllDBVersions

func CurrentAllDBVersions() Versions

CurrentAllDBVersions returns the both DataDB and StorDB versions

func CurrentDBVersions

func CurrentDBVersions(storType string, isDataDB bool) Versions

CurrentDBVersions returns versions based on dbType

func CurrentDataDBVersions

func CurrentDataDBVersions() Versions

CurrentDataDBVersions returns the needed DataDB versions

func CurrentStorDBVersions

func CurrentStorDBVersions() Versions

CurrentStorDBVersions returns the needed StorDB versions

func (Versions) Compare

func (vers Versions) Compare(curent Versions, storType string, isDataDB bool) string

Compare returns the migration message if the versions are not the latest

type WeightSorter

type WeightSorter struct {
	// contains filtered or unexported fields
}

WeightSorter orders routes based on their weight, no cost involved

func NewWeightSorter

func NewWeightSorter(rS *RouteService) *WeightSorter

func (*WeightSorter) SortRoutes added in v0.11.0

func (ws *WeightSorter) SortRoutes(prflID string,
	routes map[string]*Route, suplEv *utils.CGREvent, extraOpts *optsGetRoutes) (sortedRoutes *SortedRoutes, err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL