engine

package
v1.0.0-dev Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2025 License: GPL-3.0 Imports: 58 Imported by: 80

Documentation

Index

Constants

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"
	ColRes  = "resources"
	ColIPs  = "ips"
	ColSqs  = "statqueues"
	ColSqp  = "statqueue_profiles"
	ColTps  = "threshold_profiles"
	ColThs  = "thresholds"
	ColTrs  = "trend_profiles"
	ColTrd  = "trends"
	ColRgp  = "ranking_profiles"
	ColRnk  = "rankings"
	ColFlt  = "filters"
	ColRts  = "route_profiles"
	ColAttr = "attribute_profiles"
	ColCDRs = "cdrs"
	ColCpp  = "charger_profiles"
	ColRpp  = "rate_profiles"
	ColApp  = "action_profiles"
	ColLID  = "load_ids"
	ColAnp  = "account_profiles"
)

Collection names in MongoDB.

View Source
const (
	ColCfg = "config"
)

Redis commands

Variables

View Source
var (
	MetaOriginLow  = strings.ToLower(utils.MetaOriginID)
	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 APItoAccount

func APItoAccount(tpAcc *utils.TPAccount, timezone string) (acc *utils.Account, err error)

func APItoActionProfile

func APItoActionProfile(tpAp *utils.TPActionProfile, timezone string) (ap *utils.ActionProfile, err error)

func APItoAttributeProfile

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

func APItoChargerProfile

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

func APItoRanking

func APItoRanking(tpRG *utils.TPRankingProfile) (rg *utils.RankingProfile, err error)

func APItoRateProfile

func APItoRateProfile(tpRp *utils.TPRateProfile, timezone string) (rp *utils.RateProfile, err error)

func APItoResource

func APItoResource(tpRL *utils.TPResourceProfile, timezone string) (rp *utils.ResourceProfile, err error)

func APItoRouteProfile

func APItoRouteProfile(tpRp *utils.TPRouteProfile, timezone string) (rp *utils.RouteProfile, err error)

func APItoTrends

func APItoTrends(tpTR *utils.TPTrendsProfile) (tr *utils.TrendProfile, err error)

func AccountToAPI

func AccountToAPI(acc *utils.Account) (tpAcc *utils.TPAccount)

func ActionProfileToAPI

func ActionProfileToAPI(ap *utils.ActionProfile) (tpAp *utils.TPActionProfile)

func AppendToMysqlDSNOpts

func AppendToMysqlDSNOpts(opts map[string]string) string

func AttributeProfileToAPI

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

func BlockerFromDynamics

func BlockerFromDynamics(ctx *context.Context, dBs []*utils.DynamicBlocker,
	fltrS *FilterS, tnt string, ev utils.DataProvider) (blckr bool, err error)

BlockerFromDynamics returns the value of the blocker specified by the first matching DynamicBlocker

func CallCache

func CallCache(connMgr *ConnManager, ctx *context.Context, 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

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

func CheckFilter

func CheckFilter(fltr *Filter) (err error)

func CheckVersions

func CheckVersions(storage Storage) error

CheckVersions returns an error if the db needs migration.

func ComputeIndexes

func ComputeIndexes(ctx *context.Context, dm *DataManager, tnt, grp, idxItmType string, IDs *[]string,
	transactionID string, getFilters func(tnt, id, grp 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 ConvertOptsToMapStringAny

func ConvertOptsToMapStringAny(in any) (map[string]any, error)

func CsvDump

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

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

func ExtractURLFromHTTPType

func ExtractURLFromHTTPType(typeStr string) (string, error)

ExtractURLFromHTTPType parses a type string in the format "prefix#url" and returns the URL portion.

func FilterToTPFilter

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

func GetAPIBan

func GetAPIBan(ctx *context.Context, ip string, apiKeys []string, single, cacheRead, cacheWrite bool) (banned bool, err error)

func GetBoolOpts

func GetBoolOpts(ctx *context.Context, tnt string, dP utils.DataProvider, cch map[string]any, fS *FilterS, dynOpts []*config.DynamicBoolOpt,
	optNames ...string) (cfgOpt bool, err error)

GetBoolOpts checks the specified option names in order among the keys in APIOpts returning the first value it finds as bool, otherwise it returns the config option if at least one filter passes or the default value if none of them do

func GetDecimalBigOpts

func GetDecimalBigOpts(ctx *context.Context, tnt string, dP utils.DataProvider, cch map[string]any, fS *FilterS, dynOpts []*config.DynamicDecimalOpt,
	optNames ...string) (cfgOpt *decimal.Big, err error)

GetDecimalBigOpts checks the specified option names in order among the keys in APIOpts returning the first value it finds as *decimal.Big, otherwise it returns the config option if at least one filter passes or the default value if none of them do

func GetDurationOpts

func GetDurationOpts(ctx *context.Context, tnt string, dP utils.DataProvider, cch map[string]any, fS *FilterS, dynOpts []*config.DynamicDurationOpt,
	optNames ...string) (cfgOpt time.Duration, err error)

GetDurationOpts checks the specified option names in order among the keys in APIOpts returning the first value it finds as time.Duration, otherwise it returns the config option if at least one filter passes or the default value if none of them do

func GetDurationOptsFromMultipleMaps

func GetDurationOptsFromMultipleMaps(ctx *context.Context, tnt string, eventStart, apiOpts, startOpts map[string]any, fS *FilterS, dynOpts []*config.DynamicDurationOpt,
	dftOpt time.Duration, optName string) (cfgOpt time.Duration, err error)

GetDurationOptsFromMultipleMaps checks the specified option names in order among the keys in APIOpts, then in startOpts, returning the first value it finds as time.Duration, otherwise it returns the config option if at least one filter passes or the default one if none of them do

func GetDurationPointerOpts

func GetDurationPointerOpts(ctx *context.Context, tnt string, dP utils.DataProvider, cch map[string]any, fS *FilterS, dynOpts []*config.DynamicDurationPointerOpt,
	optNames ...string) (cfgOpt *time.Duration, err error)

GetDurationPointerOpts checks the specified option names in order among the keys in APIOpts returning the first value it finds as *time.Duration, otherwise it returns the config option if at least one filter passes or the default value if none of them do

func GetDurationPointerOptsFromMultipleMaps

func GetDurationPointerOptsFromMultipleMaps(ctx *context.Context, tnt string, eventStart, apiOpts, startOpts map[string]any, fS *FilterS,
	dynOpts []*config.DynamicDurationPointerOpt, optName string) (cfgOpt *time.Duration, err error)

GetDurationPointerOptsFromMultipleMaps checks the specified option names in order among the keys in APIOpts, then in startOpts, returning the first value it finds as *time.Duration, otherwise it returns the config option if at least one filter passes or NOT_FOUND if none of them do

func GetFloat64Opts

func GetFloat64Opts(ctx *context.Context, tnt string, dP utils.DataProvider, cch map[string]any, fS *FilterS, dynOpts []*config.DynamicFloat64Opt,
	optNames ...string) (cfgOpt float64, err error)

GetFloat64Opts checks the specified option names in order among the keys in APIOpts returning the first value it finds as float64, otherwise it returns the config option if at least one filter passes or the default value if none of them do

func GetIntOpts

func GetIntOpts(ctx *context.Context, tnt string, dP utils.DataProvider, cch map[string]any, fS *FilterS, dynOpts []*config.DynamicIntOpt,
	optNames ...string) (cfgOpt int, err error)

GetIntOpts checks the specified option names in order among the keys in APIOpts returning the first value it finds as int, otherwise it returns the config option if at least one filter passes or the default value if none of them do

func GetIntPointerOpts

func GetIntPointerOpts(ctx *context.Context, tnt string, dP utils.DataProvider, cch map[string]any, fS *FilterS, dynOpts []*config.DynamicIntPointerOpt,
	optNames ...string) (cfgOpt *int, err error)

GetIntPointerOpts checks the specified option names in order among the keys in APIOpts returning the first value it finds as *int, otherwise it returns the config option if at least one filter passes or NOT_FOUND if none of them do

func GetInterfaceOpts

func GetInterfaceOpts(ctx *context.Context, tnt string, dP utils.DataProvider, cch map[string]any, fS *FilterS, dynOpts []*config.DynamicInterfaceOpt,
	optNames ...string) (cfgOpt any, err error)

GetInterfaceOpts checks the specified option names in order among the keys in APIOpts returning the first value it finds as any, otherwise it returns the config option if at least one filter passes or the default value if none of them do

func GetRevFltrIdxHealth

func GetRevFltrIdxHealth(ctx *context.Context, 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

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

func GetStringOpts

func GetStringOpts(ctx *context.Context, tnt string, dP utils.DataProvider, cch map[string]any, fS *FilterS, dynOpts []*config.DynamicStringOpt,
	optNames ...string) (cfgOpt string, err error)

GetStringOpts checks the specified option names in order among the keys in APIOpts returning the first value it finds as string, otherwise it returns the config option if at least one filter passes or the default value if none of them do

func GetStringSliceOpts

func GetStringSliceOpts(ctx *context.Context, tnt string, dP utils.DataProvider, cch map[string]any, fS *FilterS, dynOpts []*config.DynamicStringSliceOpt,
	dftOpt []string, optNames ...string) (cfgOpt []string, err error)

GetStringSliceOpts checks the specified option names in order among the keys in APIOpts returning the first value it finds as []string, otherwise it returns the config option if at least one filter passes or the default value if none of them do

func GetTimeOpts

func GetTimeOpts(ctx *context.Context, tnt string, dP utils.DataProvider, cch map[string]any, fS *FilterS, dynOpts []*config.DynamicStringOpt,
	tmz string, optNames ...string) (_ time.Time, err error)

GetTimeOpts checks the specified option names in order among the keys in APIOpts returning the first value it finds as time.Time, otherwise it returns the config option if at least one filter passes or the default value if none of them do

func HTTPPstrTransport

func HTTPPstrTransport() *http.Transport

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

func IsDynamicDPPath

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 MakeExternalAPIRequest

func MakeExternalAPIRequest(url string, reader io.Reader) (string, error)

MakeExternalAPIRequest makes an HTTP GET request to the specified URL with the provided request body and returns the response body as a string.

func MatchingItemIDsForEvent

func MatchingItemIDsForEvent(ctx *context.Context, ev utils.MapStorage, stringFldIDs, prefixFldIDs, suffixFldIDs, existsFldIDs, notExistsFldIDs *[]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

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,
	biRPCClient any, 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,
	biRPCClient any, poolID string, connCache *ltcache.Cache) (rpcPool *rpcclient.RPCPool, err error)

NewRPCPool returns a new pool of connection with the given configuration

func NewServiceWithPing

func NewServiceWithPing(val any, name, prefix string) (*birpc.Service, error)

func OverwriteDBVersions

func OverwriteDBVersions(storage Storage) (err error)

OverwriteDBVersions sets the version overwriting them

func RankingProfileToAPI

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

func RateProfileToAPI

func RateProfileToAPI(rp *utils.RateProfile) (tpRp *utils.TPRateProfile)

func ResourceProfileToAPI

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

func RouteProfileToAPI

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

func SetConnManager

func SetConnManager(cm *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 SetHTTPPstrTransport

func SetHTTPPstrTransport(pstrTransport *http.Transport)

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

func StatQueueProfileToAPI

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

func ThresholdProfileToAPI

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

func TrendProfileToAPI

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

func UpdateFilterIndex

func UpdateFilterIndex(ctx *context.Context, 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 will set the connID in cache

func WeightFromDynamics

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

Weight returns the weight specified by the first matching DynamicWeight

Types

type AccountMdl

type AccountMdl struct {
	PK                    uint `gorm:"primary_key"`
	Tpid                  string
	Tenant                string `index:"0" re:".*"`
	ID                    string `index:"1" re:".*"`
	FilterIDs             string `index:"2" re:".*"`
	Weights               string `index:"3" re:".*"`
	Blockers              string `index:"4" re:".*"`
	Opts                  string `index:"5" re:".*"`
	BalanceID             string `index:"6" re:".*"`
	BalanceFilterIDs      string `index:"7" re:".*"`
	BalanceWeights        string `index:"8" re:".*"`
	BalanceBlockers       string `index:"9" re:".*"`
	BalanceType           string `index:"10" re:".*"`
	BalanceUnits          string `index:"11" re:".*"`
	BalanceUnitFactors    string `index:"12" re:".*"`
	BalanceOpts           string `index:"13" re:".*"`
	BalanceCostIncrements string `index:"14" re:".*"`
	BalanceAttributeIDs   string `index:"15" re:".*"`
	BalanceRateProfileIDs string `index:"16" re:".*"`
	ThresholdIDs          string `index:"17" re:".*"`
	CreatedAt             time.Time
}

func (AccountMdl) TableName

func (AccountMdl) TableName() string

type AccountMdls

type AccountMdls []*AccountMdl

func APItoModelTPAccount

func APItoModelTPAccount(tPrf *utils.TPAccount) (mdls AccountMdls)

func (AccountMdls) AsTPAccount

func (apm AccountMdls) AsTPAccount() (result []*utils.TPAccount, err error)

func (AccountMdls) CSVHeader

func (apm AccountMdls) CSVHeader() (result []string)

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

type ActionProfileMdl

type ActionProfileMdl struct {
	PK              uint `gorm:"primary_key"`
	Tpid            string
	Tenant          string `index:"0" re:".*"`
	ID              string `index:"1" re:".*"`
	FilterIDs       string `index:"2" re:".*"`
	Weights         string `index:"3" re:".*"`
	Blockers        string `index:"4" re:".*"`
	Schedule        string `index:"5" re:".*"`
	TargetType      string `index:"6" re:".*"`
	TargetIDs       string `index:"7" re:".*"`
	ActionID        string `index:"8" re:".*"`
	ActionFilterIDs string `index:"9" re:".*"`
	ActionTTL       string `index:"10" re:".*"`
	ActionType      string `index:"11" re:".*"`
	ActionOpts      string `index:"12" re:".*"`
	ActionPath      string `index:"13" re:".*"`
	ActionValue     string `index:"14" re:".*"`

	CreatedAt time.Time
}

func (ActionProfileMdl) TableName

func (ActionProfileMdl) TableName() string

type ActionProfileMdls

type ActionProfileMdls []*ActionProfileMdl

func APItoModelTPActionProfile

func APItoModelTPActionProfile(tPrf *utils.TPActionProfile) (mdls ActionProfileMdls)

func (ActionProfileMdls) AsTPActionProfile

func (apm ActionProfileMdls) AsTPActionProfile() (result []*utils.TPActionProfile)

func (ActionProfileMdls) CSVHeader

func (apm ActionProfileMdls) CSVHeader() (result []string)

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

type ArgsFiltersMatch

type ArgsFiltersMatch struct {
	*utils.CGREvent
	FilterIDs []string
}

type AttributeMdl

type AttributeMdl struct {
	PK                 uint `gorm:"primary_key"`
	Tpid               string
	Tenant             string `index:"0" re:".*"`
	ID                 string `index:"1" re:".*"`
	FilterIDs          string `index:"2" re:".*"`
	Weights            string `index:"3" re:".*"`
	Blockers           string `index:"4" re:".*"`
	AttributeFilterIDs string `index:"5" re:".*"`
	AttributeBlockers  string `index:"6" re:".*"`
	Path               string `index:"7" re:".*"`
	Type               string `index:"8" re:".*"`
	Value              string `index:"9" re:".*"`
	CreatedAt          time.Time
}

func (AttributeMdl) TableName

func (AttributeMdl) TableName() string

type AttributeMdls

type AttributeMdls []*AttributeMdl

func APItoModelTPAttribute

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

func (AttributeMdls) AsTPAttributes

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

func (AttributeMdls) CSVHeader

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

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

type CDRsql

type CDRsql struct {
	ID          int64
	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 CSVStorage

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

CSVStorage the basic csv storage

func NewCSVStorage

func NewCSVStorage(sep rune,
	resProfilesFn, statsFn, rankingsFn, trendsFn, thresholdsFn, filterFn, routeProfilesFn,
	attributeProfilesFn, chargerProfilesFn,
	rateProfilesFn, actionProfilesFn, accountsFn []string) *CSVStorage

NewCSVStorage creates a CSV storege 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,
	resProfilesFn, statsFn, rankingsFn, trendsFn, thresholdsFn, filterFn, routeProfilesFn,
	attributeProfilesFn, chargerProfilesFn, dispatcherProfilesFn, dispatcherHostsFn,
	rateProfilesFn, actionProfilesFn, accountsFn string) *CSVStorage

NewStringCSVStorage creates a csv storage from strings

func NewURLCSVStorage

func NewURLCSVStorage(sep rune, dataPath string) *CSVStorage

NewURLCSVStorage returns a CSVStorage that can parse URLs

func (*CSVStorage) GetTPAccounts

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

func (*CSVStorage) GetTPActionProfiles

func (csvs *CSVStorage) GetTPActionProfiles(tpid, tenant, id string) ([]*utils.TPActionProfile, 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) GetTPFilters

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

func (*CSVStorage) GetTPRankings

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

func (*CSVStorage) GetTPRateProfiles

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

func (*CSVStorage) GetTPResources

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

func (*CSVStorage) GetTPRoutes

func (csvs *CSVStorage) GetTPRoutes(tpid, tenant, id string) ([]*utils.TPRouteProfile, 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) GetTPTrends

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 []string, 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, connMgr *ConnManager, cpS *CapsStats) (c *CacheS)

NewCacheS initializes the Cache service and executes the precaching

func (*CacheS) BeginTransaction

func (chS *CacheS) BeginTransaction() string

BeginTransaction is an exported method from TransCache

func (*CacheS) Clear

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

Clear is an exported method from TransCache

func (*CacheS) CommitTransaction

func (chS *CacheS) CommitTransaction(transID string)

CommitTransaction is an exported method from TransCache

func (*CacheS) Get

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

Get is an exported method from TransCache

func (*CacheS) GetItemIDs

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

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

GetWithRemote queries locally the cache, followed by remotes

func (*CacheS) HasItem

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

HasItem is an exported method from TransCache

func (*CacheS) Precache

func (chS *CacheS) Precache(shutdown *utils.SyncedChan)

Precache loads data from DataDB into cache at engine start

func (*CacheS) Remove

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

Remove is an exported method from TransCache

func (*CacheS) RemoveWithoutReplicate

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

RemoveWithoutReplicate is an exported method from TransCache

func (*CacheS) ReplicateRemove

func (chS *CacheS) ReplicateRemove(ctx *context.Context, chID, itmID string) (err error)

ReplicateRemove replicate an item to ReplicationConns

func (*CacheS) ReplicateSet

func (chS *CacheS) ReplicateSet(ctx *context.Context, chID, itmID string, value any) (err error)

ReplicateSet replicate an item to ReplicationConns

func (*CacheS) RollbackTransaction

func (chS *CacheS) RollbackTransaction(transID string)

RollbackTransaction is an exported method from TransCache

func (*CacheS) Set

func (chS *CacheS) Set(ctx *context.Context, 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

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

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

func (*CacheS) SetWithoutReplicate

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(_ *context.Context, args *utils.ArgsGetGroupWithAPIOpts,
	rply *[]string) (err error)

func (*CacheS) V1GetItem

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

V1GetItem returns a single item from the cache

func (*CacheS) V1GetItemExpiryTime

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

func (*CacheS) V1GetItemIDs

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

APIs start here

func (*CacheS) V1GetItemWithRemote

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) V1HasGroup

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

func (*CacheS) V1HasItem

func (chS *CacheS) V1HasItem(_ *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(_ *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(_ *context.Context, args *utils.ArgsGetGroupWithAPIOpts,
	rply *string) (err error)

func (*CacheS) V1RemoveItem

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

func (*CacheS) V1RemoveItems

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

func (*CacheS) V1ReplicateRemove

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

V1ReplicateRemove replicate an item

func (*CacheS) V1ReplicateSet

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

V1ReplicateSet receives an item via replication to store in the cache

type Caps

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

Caps the structure that allocs requests for API

func NewCaps

func NewCaps(reqs int, strategy string) *Caps

NewCaps creates a new caps

func (*Caps) Allocate

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

Allocate will reserve a channel for the API call

func (*Caps) Allocated

func (cR *Caps) Allocated() int

Allocated returns the number of requests actively serviced

func (*Caps) Deallocate

func (cR *Caps) Deallocate()

Deallocate will free a channel for the API call

func (*Caps) IsLimited

func (cR *Caps) IsLimited() bool

IsLimited returns true if the limit is not 0

type CapsStats

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

CapsStats stores the stats for caps

func NewCapsStats

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

NewCapsStats returns the stats for the caps

func (*CapsStats) GetAverage

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

GetAverage returns the average allocated caps

func (*CapsStats) GetPeak

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

GetPeak returns the maximum allocated caps

func (*CapsStats) OnEvict

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

OnEvict the function that should be called on cache eviction

type ChargerMdl

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:".*"`
	Weights      string `index:"3" re:".*"`
	Blockers     string `index:"4" re:".*"`
	RunID        string `index:"5" re:".*"`
	AttributeIDs string `index:"6" re:".*"`
	CreatedAt    time.Time
}

func (ChargerMdl) TableName

func (ChargerMdl) TableName() string

type ChargerMdls

type ChargerMdls []*ChargerMdl

func APItoModelTPCharger

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

func (ChargerMdls) AsTPChargers

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

func (ChargerMdls) CSVHeader

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

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

type ConnManager

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

ConnManager handle the RPC connections

func NewConnManager

func NewConnManager(cfg *config.CGRConfig) (cM *ConnManager)

NewConnManager returns the Connection Manager

func (*ConnManager) AddInternalConn

func (cM *ConnManager) AddInternalConn(connName, apiPrefix string,
	iConnCh chan birpc.ClientConnector)

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, ctx *context.Context, subsHostIDs utils.StringSet, method string, arg, reply any) (err error)

CallWithConnIDs will call the method only on specified rpcconns

func (*ConnManager) GetDispInternalChan

func (cM *ConnManager) GetDispInternalChan() chan birpc.ClientConnector

func (*ConnManager) GetInternalChan

func (cM *ConnManager) GetInternalChan() chan birpc.ClientConnector

func (*ConnManager) Reload added in v0.10.3

func (cM *ConnManager) Reload()

Reload will clear all RPC related caches

type DataDB

type DataDB interface {
	Storage
	HasDataDrv(*context.Context, string, string, string) (bool, error)
	GetResourceProfileDrv(*context.Context, string, string) (*utils.ResourceProfile, error)
	SetResourceProfileDrv(*context.Context, *utils.ResourceProfile) error
	RemoveResourceProfileDrv(*context.Context, string, string) error
	GetResourceDrv(*context.Context, string, string) (*utils.Resource, error)
	SetResourceDrv(*context.Context, *utils.Resource) error
	RemoveResourceDrv(*context.Context, string, string) error
	GetIPProfileDrv(*context.Context, string, string) (*utils.IPProfile, error)
	SetIPProfileDrv(*context.Context, *utils.IPProfile) error
	RemoveIPProfileDrv(*context.Context, string, string) error
	GetIPAllocationsDrv(*context.Context, string, string) (*utils.IPAllocations, error)
	SetIPAllocationsDrv(*context.Context, *utils.IPAllocations) error
	RemoveIPAllocationsDrv(*context.Context, string, string) error
	GetLoadHistory(int, bool, string) ([]*utils.LoadInstance, error)
	AddLoadHistory(*utils.LoadInstance, int, string) error
	GetIndexesDrv(ctx *context.Context, idxItmType, tntCtx, idxKey, transactionID string) (indexes map[string]utils.StringSet, err error)
	SetIndexesDrv(ctx *context.Context, idxItmType, tntCtx string,
		indexes map[string]utils.StringSet, commit bool, transactionID string) (err error)
	RemoveIndexesDrv(ctx *context.Context, idxItmType, tntCtx, idxKey string) (err error)
	GetStatQueueProfileDrv(ctx *context.Context, tenant string, ID string) (sq *StatQueueProfile, err error)
	SetStatQueueProfileDrv(ctx *context.Context, sq *StatQueueProfile) (err error)
	RemStatQueueProfileDrv(ctx *context.Context, tenant, id string) (err error)
	GetStatQueueDrv(ctx *context.Context, tenant, id string) (sq *StatQueue, err error)
	SetStatQueueDrv(ctx *context.Context, ssq *StoredStatQueue, sq *StatQueue) (err error)
	RemStatQueueDrv(ctx *context.Context, tenant, id string) (err error)
	GetThresholdProfileDrv(ctx *context.Context, tenant string, ID string) (tp *ThresholdProfile, err error)
	SetThresholdProfileDrv(ctx *context.Context, tp *ThresholdProfile) (err error)
	RemThresholdProfileDrv(ctx *context.Context, tenant, id string) (err error)
	GetThresholdDrv(*context.Context, string, string) (*Threshold, error)
	SetThresholdDrv(*context.Context, *Threshold) error
	RemoveThresholdDrv(*context.Context, string, string) error
	SetRankingProfileDrv(ctx *context.Context, rp *utils.RankingProfile) (err error)
	GetRankingProfileDrv(ctx *context.Context, tenant string, id string) (sq *utils.RankingProfile, err error)
	RemRankingProfileDrv(ctx *context.Context, tenant string, id string) (err error)
	SetRankingDrv(ctx *context.Context, rn *utils.Ranking) (err error)
	GetRankingDrv(ctx *context.Context, tenant string, id string) (sq *utils.Ranking, err error)
	RemoveRankingDrv(ctx *context.Context, tenant string, id string) (err error)
	SetTrendProfileDrv(ctx *context.Context, sq *utils.TrendProfile) (err error)
	GetTrendProfileDrv(ctx *context.Context, tenant string, id string) (sq *utils.TrendProfile, err error)
	RemTrendProfileDrv(ctx *context.Context, tenant string, id string) (err error)
	GetTrendDrv(ctx *context.Context, tenant string, id string) (*utils.Trend, error)
	SetTrendDrv(ctx *context.Context, tr *utils.Trend) error
	RemoveTrendDrv(ctx *context.Context, tenant string, id string) error
	GetFilterDrv(ctx *context.Context, tnt string, id string) (*Filter, error)
	SetFilterDrv(ctx *context.Context, f *Filter) error
	RemoveFilterDrv(ctx *context.Context, tnt string, id string) error
	GetRouteProfileDrv(*context.Context, string, string) (*utils.RouteProfile, error)
	SetRouteProfileDrv(*context.Context, *utils.RouteProfile) error
	RemoveRouteProfileDrv(*context.Context, string, string) error
	GetAttributeProfileDrv(ctx *context.Context, tnt string, id string) (*utils.AttributeProfile, error)
	SetAttributeProfileDrv(ctx *context.Context, attr *utils.AttributeProfile) error
	RemoveAttributeProfileDrv(*context.Context, string, string) error
	GetChargerProfileDrv(*context.Context, string, string) (*utils.ChargerProfile, error)
	SetChargerProfileDrv(*context.Context, *utils.ChargerProfile) error
	RemoveChargerProfileDrv(*context.Context, string, string) error
	GetItemLoadIDsDrv(ctx *context.Context, itemIDPrefix string) (loadIDs map[string]int64, err error)
	SetLoadIDsDrv(ctx *context.Context, loadIDs map[string]int64) error
	RemoveLoadIDsDrv() error
	GetRateProfileDrv(*context.Context, string, string) (*utils.RateProfile, error)
	GetRateProfileRatesDrv(*context.Context, string, string, string, bool) ([]string, []*utils.Rate, error)
	SetRateProfileDrv(*context.Context, *utils.RateProfile, bool) error
	RemoveRateProfileDrv(*context.Context, string, string, *[]string) error
	GetActionProfileDrv(*context.Context, string, string) (*utils.ActionProfile, error)
	SetActionProfileDrv(*context.Context, *utils.ActionProfile) error
	RemoveActionProfileDrv(*context.Context, string, string) error
	GetAccountDrv(*context.Context, string, string) (*utils.Account, error)
	SetAccountDrv(ctx *context.Context, profile *utils.Account) error
	RemoveAccountDrv(*context.Context, string, string) error
	GetConfigSectionsDrv(*context.Context, string, []string) (map[string][]byte, error)
	SetConfigSectionsDrv(*context.Context, string, map[string][]byte) error
	RemoveConfigSectionsDrv(*context.Context, string, []string) error
	DumpDataDB() error
	RewriteDataDB() error
	BackupDataDB(string, bool) error
}

OnlineStorage contains methods to use for administering online data

type DataDBDriver

type DataDBDriver interface {
	DataDB
	config.ConfigDB
}

DataDBDriver used as a DataDB but also as a ConfigProvider

func NewDataDBConn

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

NewDataDBConn creates a DataDB connection

type DataDBMock

type DataDBMock struct {
	RemoveRateProfileDrvF      func(ctx *context.Context, str1 string, str2 string, rateIDs *[]string) error
	SetRateProfileDrvF         func(*context.Context, *utils.RateProfile, bool) error
	GetRateProfileDrvF         func(*context.Context, string, string) (*utils.RateProfile, error)
	GetRateProfileRatesDrvF    func(*context.Context, string, string, string, bool) ([]string, []*utils.Rate, error)
	GetKeysForPrefixF          func(*context.Context, string) ([]string, error)
	GetIndexesDrvF             func(ctx *context.Context, idxItmType, tntCtx, idxKey, transactionID string) (indexes map[string]utils.StringSet, err error)
	SetIndexesDrvF             func(ctx *context.Context, idxItmType, tntCtx string, indexes map[string]utils.StringSet, commit bool, transactionID string) (err error)
	GetAttributeProfileDrvF    func(ctx *context.Context, str1 string, str2 string) (*utils.AttributeProfile, error)
	SetAttributeProfileDrvF    func(ctx *context.Context, attr *utils.AttributeProfile) error
	RemoveAttributeProfileDrvF func(ctx *context.Context, str1 string, str2 string) error
	SetLoadIDsDrvF             func(ctx *context.Context, loadIDs map[string]int64) error
	GetFilterDrvF              func(ctx *context.Context, str1 string, str2 string) (*Filter, error)
	GetChargerProfileDrvF      func(ctx *context.Context, tnt, id string) (*utils.ChargerProfile, error)
	SetChargerProfileDrvF      func(ctx *context.Context, chr *utils.ChargerProfile) (err error)
	GetThresholdProfileDrvF    func(ctx *context.Context, tenant, id string) (tp *ThresholdProfile, err error)
	SetThresholdProfileDrvF    func(ctx *context.Context, tp *ThresholdProfile) (err error)
	RemThresholdProfileDrvF    func(ctx *context.Context, tenant, id string) (err error)
	GetThresholdDrvF           func(ctx *context.Context, tenant, id string) (*Threshold, error)
	RemoveThresholdDrvF        func(ctx *context.Context, tnt, id string) error
	GetResourceProfileDrvF     func(ctx *context.Context, tnt, id string) (*utils.ResourceProfile, error)
	SetResourceProfileDrvF     func(ctx *context.Context, rp *utils.ResourceProfile) error
	RemoveResourceProfileDrvF  func(ctx *context.Context, tnt, id string) error
	RemoveResourceDrvF         func(ctx *context.Context, tnt, id string) error
	SetResourceDrvF            func(ctx *context.Context, r *utils.Resource) error
	GetResourceDrvF            func(ctx *context.Context, tenant, id string) (*utils.Resource, error)
	GetIPProfileDrvF           func(ctx *context.Context, tnt, id string) (*utils.IPProfile, error)
	SetIPProfileDrvF           func(ctx *context.Context, ipp *utils.IPProfile) error
	RemoveIPProfileDrvF        func(ctx *context.Context, tnt, id string) error
	RemoveIPAllocationsDrvF    func(ctx *context.Context, tnt, id string) error
	SetIPAllocationsDrvF       func(ctx *context.Context, ip *utils.IPAllocations) error
	GetIPAllocationsDrvF       func(ctx *context.Context, tenant, id string) (*utils.IPAllocations, error)
	SetTrendProfileDrvF        func(ctx *context.Context, tr *utils.TrendProfile) (err error)
	GetTrendProfileDrvF        func(ctx *context.Context, tenant string, id string) (sq *utils.TrendProfile, err error)
	RemTrendProfileDrvF        func(ctx *context.Context, tenant string, id string) (err error)
	SetRankingProfileDrvF      func(ctx *context.Context, sq *utils.RankingProfile) (err error)
	GetRankingProfileDrvF      func(ctx *context.Context, tenant string, id string) (sq *utils.RankingProfile, err error)
	RemRankingProfileDrvF      func(ctx *context.Context, tenant string, id string) (err error)
	GetStatQueueProfileDrvF    func(ctx *context.Context, tenant, id string) (sq *StatQueueProfile, err error)
	SetStatQueueProfileDrvF    func(ctx *context.Context, sq *StatQueueProfile) (err error)
	RemStatQueueProfileDrvF    func(ctx *context.Context, tenant, id string) (err error)
	RemStatQueueDrvF           func(ctx *context.Context, tenant, id string) (err error)
	SetFilterDrvF              func(ctx *context.Context, fltr *Filter) error
	GetActionProfileDrvF       func(ctx *context.Context, tenant string, ID string) (*utils.ActionProfile, error)
	SetActionProfileDrvF       func(ctx *context.Context, ap *utils.ActionProfile) error
	RemoveActionProfileDrvF    func(ctx *context.Context, tenant string, ID string) error
	RemoveFilterDrvF           func(ctx *context.Context, str1 string, str2 string) error
	SetAccountDrvF             func(ctx *context.Context, profile *utils.Account) error
	GetAccountDrvF             func(ctx *context.Context, str1 string, str2 string) (*utils.Account, error)
	RemoveAccountDrvF          func(ctx *context.Context, str1 string, str2 string) error
	GetRouteProfileDrvF        func(ctx *context.Context, tnt, id string) (*utils.RouteProfile, error)
	SetRouteProfileDrvF        func(ctx *context.Context, rtPrf *utils.RouteProfile) error
	RemoveRouteProfileDrvF     func(ctx *context.Context, tnt, id string) error
	RemoveChargerProfileDrvF   func(ctx *context.Context, chr string, rpl string) error
	GetItemLoadIDsDrvF         func(ctx *context.Context, itemIDPrefix string) (loadIDs map[string]int64, err error)
	SetThresholdDrvF           func(*context.Context, *Threshold) error
	SetStatQueueDrvF           func(*context.Context, *StoredStatQueue, *StatQueue) error
	HasDataDrvF                func(ctx *context.Context, category, subject, tenant string) (bool, error)
	RemoveIndexesDrvF          func(ctx *context.Context, idxItmType, tntCtx, idxKey string) error
	GetStatQueueDrvF           func(ctx *context.Context, tenant, id string) (sq *StatQueue, err error)
}

func (*DataDBMock) AddLoadHistory

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

func (*DataDBMock) BackupDataDB

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

func (*DataDBMock) BackupStorDBDump

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

func (*DataDBMock) Close

func (dbM *DataDBMock) Close()

Storage methods

func (*DataDBMock) DumpDataDB

func (dbM *DataDBMock) DumpDataDB() error

func (*DataDBMock) Flush

func (dbM *DataDBMock) Flush(string) error

func (*DataDBMock) GetAccountDrv

func (dbM *DataDBMock) GetAccountDrv(ctx *context.Context, str1 string, str2 string) (*utils.Account, error)

func (*DataDBMock) GetActionProfileDrv

func (dbM *DataDBMock) GetActionProfileDrv(ctx *context.Context, tenant string, ID string) (*utils.ActionProfile, error)

func (*DataDBMock) GetAttributeProfileDrv

func (dbM *DataDBMock) GetAttributeProfileDrv(ctx *context.Context, str1 string, str2 string) (*utils.AttributeProfile, error)

func (*DataDBMock) GetChargerProfileDrv

func (dbM *DataDBMock) GetChargerProfileDrv(ctx *context.Context, tnt, id string) (*utils.ChargerProfile, error)

func (*DataDBMock) GetConfigSectionsDrv

func (dbM *DataDBMock) GetConfigSectionsDrv(ctx *context.Context, nodeID string, sectionIDs []string) (map[string][]byte, error)

func (*DataDBMock) GetFilterDrv

func (dbM *DataDBMock) GetFilterDrv(ctx *context.Context, str1 string, str2 string) (*Filter, error)

func (*DataDBMock) GetIPAllocationsDrv

func (dbM *DataDBMock) GetIPAllocationsDrv(ctx *context.Context, tenant, id string) (*utils.IPAllocations, error)

func (*DataDBMock) GetIPProfileDrv

func (dbM *DataDBMock) GetIPProfileDrv(ctx *context.Context, tnt, id string) (*utils.IPProfile, error)

func (*DataDBMock) GetIndexesDrv

func (dbM *DataDBMock) GetIndexesDrv(ctx *context.Context, idxItmType, tntCtx, idxKey, transactionID string) (indexes map[string]utils.StringSet, err error)

func (*DataDBMock) GetItemLoadIDsDrv

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

func (*DataDBMock) GetKeysForPrefix

func (dbM *DataDBMock) GetKeysForPrefix(ctx *context.Context, prf string) ([]string, error)

func (*DataDBMock) GetLoadHistory

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

func (*DataDBMock) GetRankingDrv

func (dbM *DataDBMock) GetRankingDrv(ctx *context.Context, tenant, id string) (*utils.Ranking, error)

func (*DataDBMock) GetRankingProfileDrv

func (dbM *DataDBMock) GetRankingProfileDrv(ctx *context.Context, tenant, id string) (sg *utils.RankingProfile, err error)

func (*DataDBMock) GetRateProfileDrv

func (dbM *DataDBMock) GetRateProfileDrv(ctx *context.Context, tnt string, id string) (*utils.RateProfile, error)

func (*DataDBMock) GetRateProfileRatesDrv

func (dbM *DataDBMock) GetRateProfileRatesDrv(ctx *context.Context, tnt string, id string, rtPrfx string, needIDs bool) ([]string, []*utils.Rate, error)

func (*DataDBMock) GetResourceDrv

func (dbM *DataDBMock) GetResourceDrv(ctx *context.Context, tenant, id string) (*utils.Resource, error)

func (*DataDBMock) GetResourceProfileDrv

func (dbM *DataDBMock) GetResourceProfileDrv(ctx *context.Context, tnt, id string) (*utils.ResourceProfile, error)

func (*DataDBMock) GetRouteProfileDrv

func (dbM *DataDBMock) GetRouteProfileDrv(ctx *context.Context, tnt, id string) (*utils.RouteProfile, error)

func (*DataDBMock) GetStatQueueDrv

func (dbM *DataDBMock) GetStatQueueDrv(ctx *context.Context, tenant, id string) (sq *StatQueue, err error)

func (*DataDBMock) GetStatQueueProfileDrv

func (dbM *DataDBMock) GetStatQueueProfileDrv(ctx *context.Context, tenant, id string) (sq *StatQueueProfile, err error)

func (*DataDBMock) GetStorageType

func (dbM *DataDBMock) GetStorageType() string

func (*DataDBMock) GetThresholdDrv

func (dbM *DataDBMock) GetThresholdDrv(ctx *context.Context, tenant, id string) (*Threshold, error)

func (*DataDBMock) GetThresholdProfileDrv

func (dbM *DataDBMock) GetThresholdProfileDrv(ctx *context.Context, tenant, id string) (tp *ThresholdProfile, err error)

func (*DataDBMock) GetTrendDrv

func (dbM *DataDBMock) GetTrendDrv(ctx *context.Context, tenant, id string) (*utils.Trend, error)

func (*DataDBMock) GetTrendProfileDrv

func (dbM *DataDBMock) GetTrendProfileDrv(ctx *context.Context, tenant, id string) (sg *utils.TrendProfile, err error)

func (*DataDBMock) GetVersions

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

func (*DataDBMock) HasDataDrv

func (dbM *DataDBMock) HasDataDrv(ctx *context.Context, category, subject, tenant string) (bool, error)

DataDB methods

func (*DataDBMock) IsDBEmpty

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

func (*DataDBMock) RemRankingProfileDrv

func (dbM *DataDBMock) RemRankingProfileDrv(ctx *context.Context, tenant string, id string) (err error)

func (*DataDBMock) RemStatQueueDrv

func (dbM *DataDBMock) RemStatQueueDrv(ctx *context.Context, tenant, id string) (err error)

func (*DataDBMock) RemStatQueueProfileDrv

func (dbM *DataDBMock) RemStatQueueProfileDrv(ctx *context.Context, tenant, id string) (err error)

func (*DataDBMock) RemThresholdProfileDrv

func (dbM *DataDBMock) RemThresholdProfileDrv(ctx *context.Context, tenant, id string) (err error)

func (*DataDBMock) RemTrendProfileDrv

func (dbM *DataDBMock) RemTrendProfileDrv(ctx *context.Context, tenant string, id string) (err error)

func (*DataDBMock) RemoveAccountDrv

func (dbM *DataDBMock) RemoveAccountDrv(ctx *context.Context, str1 string, str2 string) error

func (*DataDBMock) RemoveActionProfileDrv

func (dbM *DataDBMock) RemoveActionProfileDrv(ctx *context.Context, tenant string, ID string) error

func (*DataDBMock) RemoveAttributeProfileDrv

func (dbM *DataDBMock) RemoveAttributeProfileDrv(ctx *context.Context, str1 string, str2 string) error

func (*DataDBMock) RemoveChargerProfileDrv

func (dbM *DataDBMock) RemoveChargerProfileDrv(ctx *context.Context, chr string, rpl string) error

func (*DataDBMock) RemoveConfigSectionsDrv

func (dbM *DataDBMock) RemoveConfigSectionsDrv(ctx *context.Context, nodeID string, sectionIDs []string) error

func (*DataDBMock) RemoveFilterDrv

func (dbM *DataDBMock) RemoveFilterDrv(ctx *context.Context, str1 string, str2 string) error

func (*DataDBMock) RemoveIPAllocationsDrv

func (dbM *DataDBMock) RemoveIPAllocationsDrv(ctx *context.Context, tnt, id string) error

func (*DataDBMock) RemoveIPProfileDrv

func (dbM *DataDBMock) RemoveIPProfileDrv(ctx *context.Context, tnt string, id string) error

func (*DataDBMock) RemoveIndexesDrv

func (dbM *DataDBMock) RemoveIndexesDrv(ctx *context.Context, idxItmType, tntCtx, idxKey string) (err error)

func (*DataDBMock) RemoveLoadIDsDrv

func (dbM *DataDBMock) RemoveLoadIDsDrv() error

func (*DataDBMock) RemoveRankingDrv

func (dbM *DataDBMock) RemoveRankingDrv(ctx *context.Context, _ string, _ string) error

func (*DataDBMock) RemoveRateProfileDrv

func (dbM *DataDBMock) RemoveRateProfileDrv(ctx *context.Context, str1 string, str2 string, rateIDs *[]string) error

func (*DataDBMock) RemoveRatingProfileDrv

func (dbM *DataDBMock) RemoveRatingProfileDrv(string) error

func (*DataDBMock) RemoveResourceDrv

func (dbM *DataDBMock) RemoveResourceDrv(ctx *context.Context, tnt, id string) error

func (*DataDBMock) RemoveResourceProfileDrv

func (dbM *DataDBMock) RemoveResourceProfileDrv(ctx *context.Context, tnt string, id string) error

func (*DataDBMock) RemoveRouteProfileDrv

func (dbM *DataDBMock) RemoveRouteProfileDrv(ctx *context.Context, tnt, id string) error

func (*DataDBMock) RemoveThresholdDrv

func (dbM *DataDBMock) RemoveThresholdDrv(ctx *context.Context, tnt, id string) error

func (*DataDBMock) RemoveTrendDrv

func (dbM *DataDBMock) RemoveTrendDrv(ctx *context.Context, _ string, _ string) error

func (*DataDBMock) RemoveVersions

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

func (*DataDBMock) RewriteDataDB

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

func (*DataDBMock) SelectDatabase

func (dbM *DataDBMock) SelectDatabase(dbName string) (err error)

func (*DataDBMock) SetAccountDrv

func (dbM *DataDBMock) SetAccountDrv(ctx *context.Context, profile *utils.Account) error

func (*DataDBMock) SetActionProfileDrv

func (dbM *DataDBMock) SetActionProfileDrv(ctx *context.Context, ap *utils.ActionProfile) error

func (*DataDBMock) SetAttributeProfileDrv

func (dbM *DataDBMock) SetAttributeProfileDrv(ctx *context.Context, attr *utils.AttributeProfile) error

func (*DataDBMock) SetChargerProfileDrv

func (dbM *DataDBMock) SetChargerProfileDrv(ctx *context.Context, chrg *utils.ChargerProfile) error

func (*DataDBMock) SetConfigSectionsDrv

func (dbM *DataDBMock) SetConfigSectionsDrv(ctx *context.Context, nodeID string, sectionsData map[string][]byte) error

func (*DataDBMock) SetFilterDrv

func (dbM *DataDBMock) SetFilterDrv(ctx *context.Context, fltr *Filter) error

func (*DataDBMock) SetIPAllocationsDrv

func (dbM *DataDBMock) SetIPAllocationsDrv(ctx *context.Context, ip *utils.IPAllocations) error

func (*DataDBMock) SetIPProfileDrv

func (dbM *DataDBMock) SetIPProfileDrv(ctx *context.Context, ipp *utils.IPProfile) error

func (*DataDBMock) SetIndexesDrv

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

func (*DataDBMock) SetLoadIDsDrv

func (dbM *DataDBMock) SetLoadIDsDrv(ctx *context.Context, loadIDs map[string]int64) error

func (*DataDBMock) SetRankingDrv

func (dbM *DataDBMock) SetRankingDrv(ctx *context.Context, _ *utils.Ranking) error

func (*DataDBMock) SetRankingProfileDrv

func (dbM *DataDBMock) SetRankingProfileDrv(ctx *context.Context, rg *utils.RankingProfile) (err error)

func (*DataDBMock) SetRateProfileDrv

func (dbM *DataDBMock) SetRateProfileDrv(ctx *context.Context, rt *utils.RateProfile, optOverwrite bool) error

func (*DataDBMock) SetResourceDrv

func (dbM *DataDBMock) SetResourceDrv(ctx *context.Context, r *utils.Resource) error

func (*DataDBMock) SetResourceProfileDrv

func (dbM *DataDBMock) SetResourceProfileDrv(ctx *context.Context, resPrf *utils.ResourceProfile) error

func (*DataDBMock) SetRouteProfileDrv

func (dbM *DataDBMock) SetRouteProfileDrv(ctx *context.Context, rtPrf *utils.RouteProfile) error

func (*DataDBMock) SetStatQueueDrv

func (dbM *DataDBMock) SetStatQueueDrv(ctx *context.Context, ssq *StoredStatQueue, sq *StatQueue) (err error)

func (*DataDBMock) SetStatQueueProfileDrv

func (dbM *DataDBMock) SetStatQueueProfileDrv(ctx *context.Context, sq *StatQueueProfile) (err error)

func (*DataDBMock) SetThresholdDrv

func (dbM *DataDBMock) SetThresholdDrv(*context.Context, *Threshold) error

func (*DataDBMock) SetThresholdProfileDrv

func (dbM *DataDBMock) SetThresholdProfileDrv(ctx *context.Context, tp *ThresholdProfile) (err error)

func (*DataDBMock) SetTrendDrv

func (dbM *DataDBMock) SetTrendDrv(ctx *context.Context, tr *utils.Trend) error

func (*DataDBMock) SetTrendProfileDrv

func (dbM *DataDBMock) SetTrendProfileDrv(ctx *context.Context, trend *utils.TrendProfile) (err error)

func (*DataDBMock) SetVersions

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

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, cfg *config.CGRConfig, connMgr *ConnManager) *DataManager

NewDataManager returns a new DataManager

func (*DataManager) CacheDataFromDB

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

func (*DataManager) DataDB

func (dm *DataManager) DataDB() DataDB

DataDB exports access to dataDB

func (*DataManager) GetAccount

func (dm *DataManager) GetAccount(ctx *context.Context, tenant, id string) (ap *utils.Account, err error)

func (*DataManager) GetActionProfile

func (dm *DataManager) GetActionProfile(ctx *context.Context, tenant, id string, cacheRead, cacheWrite bool,
	transactionID string) (ap *utils.ActionProfile, err error)

func (*DataManager) GetAttributeProfile

func (dm *DataManager) GetAttributeProfile(ctx *context.Context, tenant, id string, cacheRead, cacheWrite bool,
	transactionID string) (attrPrfl *utils.AttributeProfile, err error)

GetAttributeProfile returns the AttributeProfile with the given id

func (*DataManager) GetChargerProfile

func (dm *DataManager) GetChargerProfile(ctx *context.Context, tenant, id string, cacheRead, cacheWrite bool,
	transactionID string) (cpp *utils.ChargerProfile, err error)

func (*DataManager) GetFilter

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

GetFilter returns a filter based on the given ID

func (*DataManager) GetIPAllocations

func (dm *DataManager) GetIPAllocations(ctx *context.Context, tenant, id string, cacheRead, cacheWrite bool,
	transactionID string) (ip *utils.IPAllocations, err error)

func (*DataManager) GetIPProfile

func (dm *DataManager) GetIPProfile(ctx *context.Context, tenant, id string, cacheRead, cacheWrite bool,
	transactionID string) (ipp *utils.IPProfile, err error)

func (*DataManager) GetIndexes

func (dm *DataManager) GetIndexes(ctx *context.Context, idxItmType, tntCtx, idxKey, transactionID string,
	cacheRead, cacheWrite bool) (indexes map[string]utils.StringSet, err error)

func (*DataManager) GetItemLoadIDs

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

func (*DataManager) GetRanking

func (dm *DataManager) GetRanking(ctx *context.Context, tenant, id string, cacheRead, cacheWrite bool, transactionID string) (rn *utils.Ranking, err error)

func (*DataManager) GetRankingProfile

func (dm *DataManager) GetRankingProfile(ctx *context.Context, tenant, id string, cacheRead, cacheWrite bool, transactionID string) (rgp *utils.RankingProfile, err error)

func (*DataManager) GetRankingProfileIDs

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

func (*DataManager) GetRateProfile

func (dm *DataManager) GetRateProfile(ctx *context.Context, tenant, id string, cacheRead, cacheWrite bool,
	transactionID string) (rpp *utils.RateProfile, err error)

func (*DataManager) GetRateProfileRates

func (dm *DataManager) GetRateProfileRates(ctx *context.Context, args *utils.ArgsSubItemIDs, needIDs bool) (rateIDs []string, rates []*utils.Rate, err error)

func (*DataManager) GetResource

func (dm *DataManager) GetResource(ctx *context.Context, tenant, id string, cacheRead, cacheWrite bool,
	transactionID string) (rs *utils.Resource, err error)

func (*DataManager) GetResourceProfile

func (dm *DataManager) GetResourceProfile(ctx *context.Context, tenant, id string, cacheRead, cacheWrite bool,
	transactionID string) (rp *utils.ResourceProfile, err error)

func (*DataManager) GetRouteProfile

func (dm *DataManager) GetRouteProfile(ctx *context.Context, tenant, id string, cacheRead, cacheWrite bool,
	transactionID string) (rpp *utils.RouteProfile, err error)

func (*DataManager) GetStatQueue

func (dm *DataManager) GetStatQueue(ctx *context.Context, 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(ctx *context.Context, tenant, id string, cacheRead, cacheWrite bool,
	transactionID string) (sqp *StatQueueProfile, err error)

func (*DataManager) GetThreshold

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

func (*DataManager) GetThresholdProfile

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

func (*DataManager) GetTrend

func (dm *DataManager) GetTrend(ctx *context.Context, tenant, id string,
	cacheRead, cacheWrite bool, transactionID string) (tr *utils.Trend, err error)

GetTrend retrieves a Trend from dataDB

func (*DataManager) GetTrendProfile

func (dm *DataManager) GetTrendProfile(ctx *context.Context, tenant, id string, cacheRead, cacheWrite bool,
	transactionID string) (trp *utils.TrendProfile, err error)

func (*DataManager) GetTrendProfileIDs

func (dm *DataManager) GetTrendProfileIDs(ctx *context.Context, 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) Reconnect

func (dm *DataManager) Reconnect(d DataDB)

Reconnect reconnects to the DB when the config was changed

func (*DataManager) RemoveAccount

func (dm *DataManager) RemoveAccount(ctx *context.Context, tenant, id string, withIndex bool) (err error)

func (*DataManager) RemoveActionProfile

func (dm *DataManager) RemoveActionProfile(ctx *context.Context, tenant, id string, withIndex bool) (err error)

func (*DataManager) RemoveAttributeProfile

func (dm *DataManager) RemoveAttributeProfile(ctx *context.Context, tenant, id string, withIndex bool) (err error)

func (*DataManager) RemoveChargerProfile

func (dm *DataManager) RemoveChargerProfile(ctx *context.Context, tenant, id string, withIndex bool) (err error)

func (*DataManager) RemoveFilter

func (dm *DataManager) RemoveFilter(ctx *context.Context, tenant, id string, withIndex bool) (err error)

func (*DataManager) RemoveIPAllocations

func (dm *DataManager) RemoveIPAllocations(ctx *context.Context, tenant, id string) (err error)

func (*DataManager) RemoveIPProfile

func (dm *DataManager) RemoveIPProfile(ctx *context.Context, tenant, id string, withIndex bool) (err error)

func (*DataManager) RemoveIndexes

func (dm *DataManager) RemoveIndexes(ctx *context.Context, idxItmType, tntCtx, idxKey string) (err error)

func (*DataManager) RemoveRanking

func (dm *DataManager) RemoveRanking(ctx *context.Context, tenant, id string) (err error)

RemoveRanking removes the stored Ranking

func (*DataManager) RemoveRankingProfile

func (dm *DataManager) RemoveRankingProfile(ctx *context.Context, tenant, id string) (err error)

func (*DataManager) RemoveRateProfile

func (dm *DataManager) RemoveRateProfile(ctx *context.Context, tenant, id string, withIndex bool) (err error)

func (*DataManager) RemoveRateProfileRates

func (dm *DataManager) RemoveRateProfileRates(ctx *context.Context, tenant, id string, rateIDs *[]string, withIndex bool) (err error)

func (*DataManager) RemoveResource

func (dm *DataManager) RemoveResource(ctx *context.Context, tenant, id string) (err error)

func (*DataManager) RemoveResourceProfile

func (dm *DataManager) RemoveResourceProfile(ctx *context.Context, tenant, id string, withIndex bool) (err error)

func (*DataManager) RemoveRouteProfile

func (dm *DataManager) RemoveRouteProfile(ctx *context.Context, tenant, id string, withIndex bool) (err error)

func (*DataManager) RemoveStatQueue

func (dm *DataManager) RemoveStatQueue(ctx *context.Context, tenant, id string) (err error)

RemoveStatQueue removes the StoredStatQueue

func (*DataManager) RemoveStatQueueProfile

func (dm *DataManager) RemoveStatQueueProfile(ctx *context.Context, tenant, id string, withIndex bool) (err error)

func (*DataManager) RemoveThreshold

func (dm *DataManager) RemoveThreshold(ctx *context.Context, tenant, id string) (err error)

func (*DataManager) RemoveThresholdProfile

func (dm *DataManager) RemoveThresholdProfile(ctx *context.Context, tenant, id string, withIndex bool) (err error)

func (*DataManager) RemoveTrend

func (dm *DataManager) RemoveTrend(ctx *context.Context, tenant, id string) (err error)

RemoveTrend removes the stored Trend

func (*DataManager) RemoveTrendProfile

func (dm *DataManager) RemoveTrendProfile(ctx *context.Context, tenant, id string) (err error)

func (*DataManager) SetAccount

func (dm *DataManager) SetAccount(ctx *context.Context, ap *utils.Account, withIndex bool) (err error)

func (*DataManager) SetActionProfile

func (dm *DataManager) SetActionProfile(ctx *context.Context, ap *utils.ActionProfile, withIndex bool) (err error)

func (*DataManager) SetAttributeProfile

func (dm *DataManager) SetAttributeProfile(ctx *context.Context, ap *utils.AttributeProfile, withIndex bool) (err error)

func (*DataManager) SetChargerProfile

func (dm *DataManager) SetChargerProfile(ctx *context.Context, cpp *utils.ChargerProfile, withIndex bool) (err error)

func (*DataManager) SetFilter

func (dm *DataManager) SetFilter(ctx *context.Context, fltr *Filter, withIndex bool) (err error)

func (*DataManager) SetIPAllocations

func (dm *DataManager) SetIPAllocations(ctx *context.Context, ip *utils.IPAllocations) (err error)

func (*DataManager) SetIPProfile

func (dm *DataManager) SetIPProfile(ctx *context.Context, ipp *utils.IPProfile, withIndex bool) (err error)

func (*DataManager) SetIndexes

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

func (*DataManager) SetLoadIDs

func (dm *DataManager) SetLoadIDs(ctx *context.Context, loadIDs map[string]int64) (err error)

SetLoadIDs sets the loadIDs in the DB

func (*DataManager) SetRanking

func (dm *DataManager) SetRanking(ctx *context.Context, rn *utils.Ranking) (err error)

SetRanking stores Ranking in dataDB

func (*DataManager) SetRankingProfile

func (dm *DataManager) SetRankingProfile(ctx *context.Context, rnp *utils.RankingProfile) (err error)

func (*DataManager) SetRateProfile

func (dm *DataManager) SetRateProfile(ctx *context.Context, rpp *utils.RateProfile, optOverwrite, withIndex bool) (err error)

func (*DataManager) SetResource

func (dm *DataManager) SetResource(ctx *context.Context, rs *utils.Resource) (err error)

func (*DataManager) SetResourceProfile

func (dm *DataManager) SetResourceProfile(ctx *context.Context, rp *utils.ResourceProfile, withIndex bool) (err error)

func (*DataManager) SetRouteProfile

func (dm *DataManager) SetRouteProfile(ctx *context.Context, rpp *utils.RouteProfile, withIndex bool) (err error)

func (*DataManager) SetStatQueue

func (dm *DataManager) SetStatQueue(ctx *context.Context, sq *StatQueue) (err error)

SetStatQueue converts to StoredStatQueue and stores the result in dataDB

func (*DataManager) SetStatQueueProfile

func (dm *DataManager) SetStatQueueProfile(ctx *context.Context, sqp *StatQueueProfile, withIndex bool) (err error)

func (*DataManager) SetThreshold

func (dm *DataManager) SetThreshold(ctx *context.Context, th *Threshold) (err error)

func (*DataManager) SetThresholdProfile

func (dm *DataManager) SetThresholdProfile(ctx *context.Context, th *ThresholdProfile, withIndex bool) (err error)

func (*DataManager) SetTrend

func (dm *DataManager) SetTrend(ctx *context.Context, tr *utils.Trend) (err error)

SetTrend stores Trend in dataDB

func (*DataManager) SetTrendProfile

func (dm *DataManager) SetTrendProfile(ctx *context.Context, trp *utils.TrendProfile) (err error)

type DecimalWithCompress

type DecimalWithCompress struct {
	Stat           *utils.Decimal
	CompressFactor uint64
}

ACDHelper structure

type DispatcherHost

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

DispatcherHost represents one virtual host used by dispatcher

func (*DispatcherHost) FieldAsInterface

func (dH *DispatcherHost) FieldAsInterface(fldPath []string) (_ any, err error)

func (*DispatcherHost) FieldAsString

func (dH *DispatcherHost) FieldAsString(fldPath []string) (_ string, err error)

func (*DispatcherHost) GetConn

func (dH *DispatcherHost) GetConn(ctx *context.Context, cfg *config.CGRConfig, iPRCCh chan birpc.ClientConnector) (_ birpc.ClientConnector, err error)

GetConn will build and cache the connection if it is not defined yet

func (*DispatcherHost) Merge

func (dH *DispatcherHost) Merge(v2 any)

func (*DispatcherHost) Set

func (dH *DispatcherHost) Set(path []string, val any, newBranch bool) (err error)

func (*DispatcherHost) String

func (dH *DispatcherHost) String() string

func (*DispatcherHost) TenantID

func (dH *DispatcherHost) TenantID() string

TenantID returns the tenant concatenated with the ID

type DispatcherHostIDs

type DispatcherHostIDs []string

func (DispatcherHostIDs) Clone

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

func (DispatcherHostIDs) ReorderFromIndex

func (dHPrflIDs DispatcherHostIDs) ReorderFromIndex(idx int)

ReorderFromIndex will consider idx as starting point for the reordered slice

func (DispatcherHostIDs) Shuffle

func (dHPrflIDs DispatcherHostIDs) Shuffle()

Shuffle will mix the connections in place

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)

func (*DispatcherHostProfile) FieldAsInterface

func (dC *DispatcherHostProfile) FieldAsInterface(fldPath []string) (_ any, err error)

func (*DispatcherHostProfile) FieldAsString

func (dC *DispatcherHostProfile) FieldAsString(fldPath []string) (_ string, err error)

func (*DispatcherHostProfile) Merge

func (dspHost *DispatcherHostProfile) Merge(v2 *DispatcherHostProfile)

func (*DispatcherHostProfile) String

func (dC *DispatcherHostProfile) String() string

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

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

DispatcherHostWithOpts is used in replicatorV1 for dispatcher

type DynamicDP

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

func NewDynamicDP

func NewDynamicDP(ctx *context.Context, resConns, stsConns, actsConns, trdConns, rnkCOnns []string,
	tenant string, initialDP utils.DataProvider) *DynamicDP

func (*DynamicDP) FieldAsInterface

func (dDP *DynamicDP) FieldAsInterface(fldPath []string) (val any, err error)

func (*DynamicDP) FieldAsString

func (dDP *DynamicDP) FieldAsString(fldPath []string) (string, error)

func (*DynamicDP) String

func (dDP *DynamicDP) String() string

type ExportLogger

type ExportLogger struct {
	sync.Mutex

	LogLevel   int
	FldPostDir string
	Writer     *kafka.Writer
	NodeID     string
	Tenant     string
	// contains filtered or unexported fields
}

Logs to kafka

func NewExportLogger

func NewExportLogger(ctx *context.Context, tenant string, connMgr *ConnManager,
	cfg *config.CGRConfig) *ExportLogger

NewExportLogger will export loggers to kafka

func (*ExportLogger) Alert

func (el *ExportLogger) Alert(m string) (err error)

Alert logs to EEs with alert level

func (*ExportLogger) Close

func (el *ExportLogger) Close() (err error)

func (*ExportLogger) Crit

func (el *ExportLogger) Crit(m string) (err error)

Crit logs to EEs with critical level

func (*ExportLogger) Debug

func (el *ExportLogger) Debug(m string) (err error)

Debug logs to EEs with debug level

func (*ExportLogger) Emerg

func (el *ExportLogger) Emerg(m string) (err error)

Emerg logs to EEs with emergency level

func (*ExportLogger) Err

func (el *ExportLogger) Err(m string) (err error)

Err logs to EEs with error level

func (*ExportLogger) GetLogLevel

func (el *ExportLogger) GetLogLevel() int

GetLogLevel() returns the level logger number for the server

func (*ExportLogger) GetMeta

func (el *ExportLogger) GetMeta() map[string]any

func (*ExportLogger) GetSyslog

func (sl *ExportLogger) GetSyslog() *syslog.Writer

func (*ExportLogger) Info

func (el *ExportLogger) Info(m string) (err error)

Info logs to EEs with info level

func (*ExportLogger) Notice

func (el *ExportLogger) Notice(m string) (err error)

Notice logs to EEs with notice level

func (*ExportLogger) SetLogLevel

func (el *ExportLogger) SetLogLevel(level int)

SetLogLevel changes the log level

func (*ExportLogger) Warning

func (el *ExportLogger) Warning(m string) (err error)

Warning logs to EEs with warning level

func (*ExportLogger) Write

func (el *ExportLogger) Write(p []byte) (n int, err error)

type Filter

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

Filter structure to define a basic filter

func APItoFilter

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

func GetFilters

func GetFilters(ctx *context.Context, filterIDs []string, tenant string,
	dm *DataManager) ([]*Filter, error)

GetFilters retrieves and compiles the filters identified by filterIDs for the specified tenant.

func NewFilterFromInline

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

NewFilterFromInline parses an inline rule into a compiled Filter

func (*Filter) CacheClone

func (fltr *Filter) CacheClone() any

CacheClone returns a clone of Filter used by ltcache CacheCloner

func (*Filter) Clone

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) Compress

func (fltr *Filter) Compress()

func (*Filter) FieldAsInterface

func (fltr *Filter) FieldAsInterface(fldPath []string) (_ any, err error)

func (*Filter) FieldAsString

func (fltr *Filter) FieldAsString(fldPath []string) (_ string, err error)

func (*Filter) Merge

func (fltr *Filter) Merge(v2 any)

func (*Filter) Set

func (fltr *Filter) Set(path []string, val any, newBranch bool) (err error)

func (*Filter) String

func (fltr *Filter) String() string

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(ctx *context.Context, dm *DataManager, fltrCache, fltrIdxCache, objCache *ltcache.Cache, indxType string) (rply *FilterIHReply, err error)

GetFltrIdxHealth returns the missing indexes for all objects

func GetFltrIdxHealthForRateRates

func GetFltrIdxHealthForRateRates(ctx *context.Context, dm *DataManager, fltrCache, fltrIdxCache, objCache *ltcache.Cache) (rply *FilterIHReply, err error)

GetFltrIdxHealth returns the missing indexes for all objects

type FilterMdl

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:".*"`
	CreatedAt time.Time
}

func (FilterMdl) TableName

func (FilterMdl) TableName() string

type FilterMdls

type FilterMdls []*FilterMdl

func APItoModelTPFilter

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

func (FilterMdls) AsTPFilter

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

func (FilterMdls) CSVHeader

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

func (fltr *FilterRule) Clone() *FilterRule

Clone method for FilterRule

func (*FilterRule) CompileValues

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

CompileValues compiles RSR fields

func (*FilterRule) FieldAsInterface

func (fltr *FilterRule) FieldAsInterface(fldPath []string) (_ any, err error)

func (*FilterRule) FieldAsString

func (fltr *FilterRule) FieldAsString(fldPath []string) (_ string, err error)

func (*FilterRule) IsValid

func (fltr *FilterRule) IsValid() bool

IsValid checks whether a filter rule is valid or not

func (*FilterRule) Pass

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

Pass is the method which should be used from outside.

func (*FilterRule) String

func (fltr *FilterRule) String() string

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

func (fS *FilterS) LazyPass(ctx *context.Context, 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(ctx *context.Context, tenant string, filterIDs []string,
	ev utils.DataProvider) (pass bool, err error)

Pass will check all filters wihin 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

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

FilterWithOpts the arguments for the replication

type IndexHealthArgs

type IndexHealthArgs struct {
	Tenant              string
	IndexCacheLimit     int
	IndexCacheTTL       time.Duration
	IndexCacheStaticTTL bool

	ObjectCacheLimit     int
	ObjectCacheTTL       time.Duration
	ObjectCacheStaticTTL bool

	FilterCacheLimit     int
	FilterCacheTTL       time.Duration
	FilterCacheStaticTTL bool
	APIOpts              map[string]any // Only for dispatcher.
}

type IntService

type IntService map[string]*birpc.Service

func NewDispatcherService

func NewDispatcherService(val any) (_ IntService, err error)

func NewService

func NewService(val any) (_ IntService, err error)

func NewServiceWithName

func NewServiceWithName(val any, name string, useName bool) (_ IntService, err error)

NewServiceWithName is used by a service to return a number of *birpc.Service objects with different versions

which are groupped by the vX prefix in the RPC capable methods of val interface. (ie: CoreS and CoreSv1)

func (IntService) Call

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/or StorDB

func NewInternalDB

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

NewInternalDB constructs an InternalDB

func (*InternalDB) AddLoadHistory

func (iDB *InternalDB) AddLoadHistory(*utils.LoadInstance, int, string) error

func (*InternalDB) BackupConfigDB

func (iDB *InternalDB) BackupConfigDB(backupFolderPath string, zip bool) (err error)

BackupConfigDB 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) BackupDataDB

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

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 depending on dump and rewrite intervals, will dump all thats left in cache collector to file and/or rewrite files, and close all files

func (*InternalDB) DumpConfigDB

func (iDB *InternalDB) DumpConfigDB() (err error)

Will dump everything inside Configdb to files

func (*InternalDB) DumpDataDB

func (iDB *InternalDB) DumpDataDB() (err error)

Will dump everything inside datadb to files

func (*InternalDB) DumpStorDB

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) GetAccountDrv

func (iDB *InternalDB) GetAccountDrv(_ *context.Context, tenant, id string) (ap *utils.Account, err error)

func (*InternalDB) GetActionProfileDrv

func (iDB *InternalDB) GetActionProfileDrv(_ *context.Context, tenant, id string) (ap *utils.ActionProfile, err error)

func (*InternalDB) GetAttributeProfileDrv

func (iDB *InternalDB) GetAttributeProfileDrv(_ *context.Context, tenant, id string) (attr *utils.AttributeProfile, err error)

func (*InternalDB) GetCDRs

func (iDB *InternalDB) GetCDRs(ctx *context.Context, qryFltr []*Filter, opts map[string]any) (cdrs []*utils.CDR, err error)

func (*InternalDB) GetChargerProfileDrv

func (iDB *InternalDB) GetChargerProfileDrv(_ *context.Context, tenant, id string) (ch *utils.ChargerProfile, err error)

func (*InternalDB) GetConfigSectionsDrv

func (iDB *InternalDB) GetConfigSectionsDrv(ctx *context.Context, nodeID string, sectionIDs []string) (sectionMap map[string][]byte, err error)

func (*InternalDB) GetFilterDrv

func (iDB *InternalDB) GetFilterDrv(_ *context.Context, tenant, id string) (fltr *Filter, err error)

func (*InternalDB) GetIPAllocationsDrv

func (iDB *InternalDB) GetIPAllocationsDrv(_ *context.Context, tenant, id string) (*utils.IPAllocations, error)

func (*InternalDB) GetIPProfileDrv

func (iDB *InternalDB) GetIPProfileDrv(_ *context.Context, tenant, id string) (*utils.IPProfile, error)

func (*InternalDB) GetIndexesDrv

func (iDB *InternalDB) GetIndexesDrv(_ *context.Context, idxItmType, tntCtx, idxKey, transactionID string) (indexes map[string]utils.StringSet, err error)

func (*InternalDB) GetItemLoadIDsDrv

func (iDB *InternalDB) GetItemLoadIDsDrv(_ *context.Context, itemIDPrefix string) (loadIDs map[string]int64, err error)

func (*InternalDB) GetKeysForPrefix

func (iDB *InternalDB) GetKeysForPrefix(_ *context.Context, prefix string) (ids []string, err error)

GetKeysForPrefix returns the keys from cache that have the given prefix

func (*InternalDB) GetLoadHistory

func (iDB *InternalDB) GetLoadHistory(int, bool, string) ([]*utils.LoadInstance, error)

func (*InternalDB) GetRankingDrv

func (iDB *InternalDB) GetRankingDrv(_ *context.Context, tenant, id string) (rn *utils.Ranking, err error)

func (*InternalDB) GetRankingProfileDrv

func (iDB *InternalDB) GetRankingProfileDrv(_ *context.Context, tenant, id string) (sg *utils.RankingProfile, err error)

func (*InternalDB) GetRateProfileDrv

func (iDB *InternalDB) GetRateProfileDrv(_ *context.Context, tenant, id string) (rpp *utils.RateProfile, err error)

func (*InternalDB) GetRateProfileRatesDrv

func (iDB *InternalDB) GetRateProfileRatesDrv(ctx *context.Context, tenant, profileID, rtPrfx string, needIDs bool) (rateIDs []string, rates []*utils.Rate, err error)

func (*InternalDB) GetResourceDrv

func (iDB *InternalDB) GetResourceDrv(_ *context.Context, tenant, id string) (r *utils.Resource, err error)

func (*InternalDB) GetResourceProfileDrv

func (iDB *InternalDB) GetResourceProfileDrv(_ *context.Context, tenant, id string) (rp *utils.ResourceProfile, err error)

func (*InternalDB) GetRouteProfileDrv

func (iDB *InternalDB) GetRouteProfileDrv(_ *context.Context, tenant, id string) (spp *utils.RouteProfile, err error)

func (*InternalDB) GetSection

func (iDB *InternalDB) GetSection(_ *context.Context, section string, val any) error

func (*InternalDB) GetStatQueueDrv

func (iDB *InternalDB) GetStatQueueDrv(_ *context.Context, tenant, id string) (sq *StatQueue, err error)

func (*InternalDB) GetStatQueueProfileDrv

func (iDB *InternalDB) GetStatQueueProfileDrv(_ *context.Context, tenant string, id string) (sq *StatQueueProfile, err error)

func (*InternalDB) GetStorageType

func (iDB *InternalDB) GetStorageType() string

GetStorageType returns the storage type

func (*InternalDB) GetThresholdDrv

func (iDB *InternalDB) GetThresholdDrv(_ *context.Context, tenant, id string) (th *Threshold, err error)

func (*InternalDB) GetThresholdProfileDrv

func (iDB *InternalDB) GetThresholdProfileDrv(_ *context.Context, tenant, id string) (tp *ThresholdProfile, err error)

func (*InternalDB) GetTrendDrv

func (iDB *InternalDB) GetTrendDrv(_ *context.Context, tenant, id string) (th *utils.Trend, err error)

func (*InternalDB) GetTrendProfileDrv

func (iDB *InternalDB) GetTrendProfileDrv(_ *context.Context, tenant, id string) (sg *utils.TrendProfile, err error)

func (*InternalDB) GetVersions

func (iDB *InternalDB) GetVersions(itm string) (vrs Versions, err error)

func (*InternalDB) HasDataDrv

func (iDB *InternalDB) HasDataDrv(_ *context.Context, category, subject, tenant string) (bool, error)

func (*InternalDB) IsDBEmpty

func (iDB *InternalDB) IsDBEmpty() (isEmpty bool, err error)

IsDBEmpty returns true if the cache is empty

func (*InternalDB) RemRankingProfileDrv

func (iDB *InternalDB) RemRankingProfileDrv(_ *context.Context, tenant, id string) (err error)

func (*InternalDB) RemStatQueueDrv

func (iDB *InternalDB) RemStatQueueDrv(_ *context.Context, tenant, id string) (err error)

func (*InternalDB) RemStatQueueProfileDrv

func (iDB *InternalDB) RemStatQueueProfileDrv(_ *context.Context, tenant, id string) (err error)

func (*InternalDB) RemThresholdProfileDrv

func (iDB *InternalDB) RemThresholdProfileDrv(_ *context.Context, tenant, id string) (err error)

func (*InternalDB) RemTrendProfileDrv

func (iDB *InternalDB) RemTrendProfileDrv(_ *context.Context, tenant, id string) (err error)

func (*InternalDB) RemoveAccountDrv

func (iDB *InternalDB) RemoveAccountDrv(_ *context.Context, tenant, id string) (err error)

func (*InternalDB) RemoveActionProfileDrv

func (iDB *InternalDB) RemoveActionProfileDrv(_ *context.Context, tenant, id string) (err error)

func (*InternalDB) RemoveAttributeProfileDrv

func (iDB *InternalDB) RemoveAttributeProfileDrv(_ *context.Context, tenant, id string) (err error)

func (*InternalDB) RemoveCDRs

func (iDB *InternalDB) RemoveCDRs(ctx *context.Context, qryFltr []*Filter) (err error)

func (*InternalDB) RemoveChargerProfileDrv

func (iDB *InternalDB) RemoveChargerProfileDrv(_ *context.Context, tenant, id string) (err error)

func (*InternalDB) RemoveConfigSectionsDrv

func (iDB *InternalDB) RemoveConfigSectionsDrv(ctx *context.Context, nodeID string, sectionIDs []string) (err error)

func (*InternalDB) RemoveFilterDrv

func (iDB *InternalDB) RemoveFilterDrv(_ *context.Context, tenant, id string) (err error)

func (*InternalDB) RemoveIPAllocationsDrv

func (iDB *InternalDB) RemoveIPAllocationsDrv(_ *context.Context, tenant, id string) error

func (*InternalDB) RemoveIPProfileDrv

func (iDB *InternalDB) RemoveIPProfileDrv(_ *context.Context, tenant, id string) error

func (*InternalDB) RemoveIndexesDrv

func (iDB *InternalDB) RemoveIndexesDrv(_ *context.Context, idxItmType, tntCtx, idxKey string) (err error)

func (*InternalDB) RemoveLoadIDsDrv

func (iDB *InternalDB) RemoveLoadIDsDrv() (err error)

func (*InternalDB) RemoveRankingDrv

func (iDB *InternalDB) RemoveRankingDrv(_ *context.Context, tenant, id string) (err error)

func (*InternalDB) RemoveRateProfileDrv

func (iDB *InternalDB) RemoveRateProfileDrv(_ *context.Context, tenant, id string, rateIDs *[]string) (err error)

func (*InternalDB) RemoveResourceDrv

func (iDB *InternalDB) RemoveResourceDrv(_ *context.Context, tenant, id string) (err error)

func (*InternalDB) RemoveResourceProfileDrv

func (iDB *InternalDB) RemoveResourceProfileDrv(_ *context.Context, tenant, id string) (err error)

func (*InternalDB) RemoveRouteProfileDrv

func (iDB *InternalDB) RemoveRouteProfileDrv(_ *context.Context, tenant, id string) (err error)

func (*InternalDB) RemoveThresholdDrv

func (iDB *InternalDB) RemoveThresholdDrv(_ *context.Context, tenant, id string) (err error)

func (*InternalDB) RemoveTrendDrv

func (iDB *InternalDB) RemoveTrendDrv(_ *context.Context, tenant, id string) (err error)

func (*InternalDB) RemoveVersions

func (iDB *InternalDB) RemoveVersions(vrs Versions) (err error)

func (*InternalDB) RewriteConfigDB

func (iDB *InternalDB) RewriteConfigDB() (err error)

Will rewrite every dump file of ConfigDB

func (*InternalDB) RewriteDataDB

func (iDB *InternalDB) RewriteDataDB() (err error)

Will rewrite every dump file of DataDB

func (*InternalDB) RewriteStorDB

func (iDB *InternalDB) RewriteStorDB() (err error)

Will rewrite every dump file of StorDB

func (*InternalDB) SelectDatabase

func (iDB *InternalDB) SelectDatabase(string) (err error)

SelectDatabase only to implement Storage interface

func (*InternalDB) SetAccountDrv

func (iDB *InternalDB) SetAccountDrv(_ *context.Context, ap *utils.Account) (err error)

func (*InternalDB) SetActionProfileDrv

func (iDB *InternalDB) SetActionProfileDrv(_ *context.Context, ap *utils.ActionProfile) (err error)

func (*InternalDB) SetAttributeProfileDrv

func (iDB *InternalDB) SetAttributeProfileDrv(_ *context.Context, attr *utils.AttributeProfile) (err error)

func (*InternalDB) SetCDR

func (iDB *InternalDB) SetCDR(_ *context.Context, cdr *utils.CGREvent, allowUpdate bool) error

SetCDR for ManagerDB interface. SetCDR will set a single CDR in internal based on the CGREvent

func (*InternalDB) SetChargerProfileDrv

func (iDB *InternalDB) SetChargerProfileDrv(_ *context.Context, chr *utils.ChargerProfile) (err error)

func (*InternalDB) SetConfigSectionsDrv

func (iDB *InternalDB) SetConfigSectionsDrv(ctx *context.Context, nodeID string, sectionsData map[string][]byte) (err error)

func (*InternalDB) SetFilterDrv

func (iDB *InternalDB) SetFilterDrv(_ *context.Context, fltr *Filter) (err error)

func (*InternalDB) SetIPAllocationsDrv

func (iDB *InternalDB) SetIPAllocationsDrv(_ *context.Context, ip *utils.IPAllocations) error

func (*InternalDB) SetIPProfileDrv

func (iDB *InternalDB) SetIPProfileDrv(_ *context.Context, ipp *utils.IPProfile) error

func (*InternalDB) SetIndexesDrv

func (iDB *InternalDB) SetIndexesDrv(_ *context.Context, idxItmType, tntCtx string,
	indexes map[string]utils.StringSet, commit bool, transactionID string) (err error)

func (*InternalDB) SetLoadIDsDrv

func (iDB *InternalDB) SetLoadIDsDrv(_ *context.Context, 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

func (iDB *InternalDB) SetRankingDrv(_ *context.Context, rn *utils.Ranking) (err error)

func (*InternalDB) SetRankingProfileDrv

func (iDB *InternalDB) SetRankingProfileDrv(_ *context.Context, sgp *utils.RankingProfile) (err error)

func (*InternalDB) SetRateProfileDrv

func (iDB *InternalDB) SetRateProfileDrv(_ *context.Context, rpp *utils.RateProfile, optOverwrite bool) (err error)

func (*InternalDB) SetResourceDrv

func (iDB *InternalDB) SetResourceDrv(_ *context.Context, r *utils.Resource) (err error)

func (*InternalDB) SetResourceProfileDrv

func (iDB *InternalDB) SetResourceProfileDrv(_ *context.Context, rp *utils.ResourceProfile) (err error)

func (*InternalDB) SetRouteProfileDrv

func (iDB *InternalDB) SetRouteProfileDrv(_ *context.Context, spp *utils.RouteProfile) (err error)

func (*InternalDB) SetSection

func (iDB *InternalDB) SetSection(_ *context.Context, section string, val any) error

func (*InternalDB) SetStatQueueDrv

func (iDB *InternalDB) SetStatQueueDrv(_ *context.Context, ssq *StoredStatQueue, sq *StatQueue) (err error)

func (*InternalDB) SetStatQueueProfileDrv

func (iDB *InternalDB) SetStatQueueProfileDrv(_ *context.Context, 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) SetThresholdDrv

func (iDB *InternalDB) SetThresholdDrv(_ *context.Context, th *Threshold) (err error)

func (*InternalDB) SetThresholdProfileDrv

func (iDB *InternalDB) SetThresholdProfileDrv(_ *context.Context, tp *ThresholdProfile) (err error)

func (*InternalDB) SetTrendDrv

func (iDB *InternalDB) SetTrendDrv(_ *context.Context, tr *utils.Trend) (err error)

func (*InternalDB) SetTrendProfileDrv

func (iDB *InternalDB) SetTrendProfileDrv(_ *context.Context, srp *utils.TrendProfile) (err error)

func (*InternalDB) SetVersions

func (iDB *InternalDB) SetVersions(vrs Versions, overwrite bool) (err error)

type LoadReader

type LoadReader interface {
	GetTpIds(string) ([]string, error)
	GetTpTableIds(string, string, []string,
		map[string]string, *utils.PaginatorWithSearch) ([]string, error)
	GetTPResources(string, string, string) ([]*utils.TPResourceProfile, error)
	GetTPStats(string, string, string) ([]*utils.TPStatProfile, error)
	GetTPRankings(tpid, tenant, id string) ([]*utils.TPRankingProfile, error)
	GetTPTrends(tpid, tenant, id string) ([]*utils.TPTrendsProfile, 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)
	GetTPRateProfiles(string, string, string) ([]*utils.TPRateProfile, error)
	GetTPActionProfiles(string, string, string) ([]*utils.TPActionProfile, error)
	GetTPAccounts(string, string, string) ([]*utils.TPAccount, 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
	SetTPResources([]*utils.TPResourceProfile) error
	SetTPStats([]*utils.TPStatProfile) error
	SetTPThresholds([]*utils.TPThresholdProfile) error
	SetTPFilters([]*utils.TPFilterProfile) error
	SetTPRoutes([]*utils.TPRouteProfile) error
	SetTPAttributes([]*utils.TPAttributeProfile) error
	SetTPChargers([]*utils.TPChargerProfile) error
	SetTPRateProfiles([]*utils.TPRateProfile) error
	SetTPActionProfiles([]*utils.TPActionProfile) error
	SetTPAccounts([]*utils.TPAccount) error
}

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) 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

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

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 MapStringDP

type MapStringDP map[string]string // map storage for string values

func (MapStringDP) FieldAsInterface

func (me MapStringDP) FieldAsInterface(fldPath []string) (any, error)

func (MapStringDP) FieldAsString

func (me MapStringDP) FieldAsString(fldPath []string) (string, error)

func (MapStringDP) String

func (me MapStringDP) String() string

type Metric

type Metric struct {
	Value     *utils.Decimal
	Count     uint64
	Events    map[string]*DecimalWithCompress // map[EventTenantID]Cost
	MinItems  uint64
	FilterIDs []string
}

func NewMetric

func NewMetric(minItems uint64, filterIDs []string) *Metric

func (*Metric) Clone

func (sum *Metric) Clone() (cln *Metric)

func (*Metric) Compress

func (sum *Metric) Compress(queueLen uint64, defaultID string) (eventIDs []string)

Compress is part of StatMetric interface

func (*Metric) Equal

func (sum *Metric) Equal(v *Metric) bool

func (*Metric) GetCompressFactor

func (sum *Metric) GetCompressFactor(events map[string]uint64) map[string]uint64

Compress is part of StatMetric interface

func (*Metric) GetFilterIDs

func (sum *Metric) GetFilterIDs() []string

func (*Metric) GetMinItems

func (sum *Metric) GetMinItems() uint64

GetMinItems returns the minim items for the metric

func (*Metric) GetStringValue

func (sum *Metric) GetStringValue(rounding int) string

func (*Metric) GetValue

func (sum *Metric) GetValue() (v *utils.Decimal)

func (*Metric) RemEvent

func (sum *Metric) RemEvent(evID string) (err error)

Deleting a specific event and updating metrics

type MetricWithFilters

type MetricWithFilters struct {
	MetricID  string
	FilterIDs []string
	Blockers  utils.DynamicBlockers // blocker flag to stop processing for next metric on filters matched
}

func (*MetricWithFilters) Clone

func (mwf *MetricWithFilters) Clone() *MetricWithFilters

Clone clones *MetricWithFilters

func (*MetricWithFilters) FieldAsInterface

func (mf *MetricWithFilters) FieldAsInterface(fldPath []string) (_ any, err error)

func (*MetricWithFilters) FieldAsString

func (mf *MetricWithFilters) FieldAsString(fldPath []string) (_ string, err error)

func (*MetricWithFilters) String

func (mf *MetricWithFilters) String() string

type MongoStorage

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

MongoStorage struct for new mongo 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) BackupConfigDB

func (ms *MongoStorage) BackupConfigDB(backupFolderPath string, zip bool) (err error)

Only intended for InternalDB

func (*MongoStorage) BackupDataDB

func (ms *MongoStorage) BackupDataDB(backupFolderPath string, zip bool) (err error)

BackupDataDB only for InternalDB

func (*MongoStorage) BackupStorDB

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) DumpConfigDB

func (ms *MongoStorage) DumpConfigDB() (err error)

Only intended for InternalDB

func (*MongoStorage) DumpDataDB

func (ms *MongoStorage) DumpDataDB() error

DumpDataDB will dump all of datadb from memory to a file, only for InternalDB

func (*MongoStorage) DumpStorDB

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) error

Flush drops the datatable and recreates the indexes.

func (*MongoStorage) GetAccountDrv

func (ms *MongoStorage) GetAccountDrv(ctx *context.Context, tenant, id string) (*utils.Account, error)

func (*MongoStorage) GetActionProfileDrv

func (ms *MongoStorage) GetActionProfileDrv(ctx *context.Context, tenant, id string) (*utils.ActionProfile, error)

func (*MongoStorage) GetAttributeProfileDrv

func (ms *MongoStorage) GetAttributeProfileDrv(ctx *context.Context, tenant, id string) (*utils.AttributeProfile, error)

func (*MongoStorage) GetCDRs

func (ms *MongoStorage) GetCDRs(ctx *context.Context, qryFltr []*Filter, opts map[string]any) (cdrs []*utils.CDR, err error)

func (*MongoStorage) GetChargerProfileDrv

func (ms *MongoStorage) GetChargerProfileDrv(ctx *context.Context, tenant, id string) (*utils.ChargerProfile, error)

func (*MongoStorage) GetConfigSectionsDrv

func (ms *MongoStorage) GetConfigSectionsDrv(ctx *context.Context, nodeID string, sectionIDs []string) (map[string][]byte, error)

func (*MongoStorage) GetContext

func (ms *MongoStorage) GetContext() *context.Context

GetContext returns the context used for the current database.

func (*MongoStorage) GetFilterDrv

func (ms *MongoStorage) GetFilterDrv(ctx *context.Context, tenant, id string) (*Filter, error)

func (*MongoStorage) GetIPAllocationsDrv

func (ms *MongoStorage) GetIPAllocationsDrv(ctx *context.Context, tenant, id string) (*utils.IPAllocations, error)

func (*MongoStorage) GetIPProfileDrv

func (ms *MongoStorage) GetIPProfileDrv(ctx *context.Context, tenant, id string) (*utils.IPProfile, error)

func (*MongoStorage) GetIndexesDrv

func (ms *MongoStorage) GetIndexesDrv(ctx *context.Context, idxItmType, tntCtx, idxKey, transactionID 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(ctx *context.Context, itemIDPrefix string) (map[string]int64, error)

func (*MongoStorage) GetKeysForPrefix

func (ms *MongoStorage) GetKeysForPrefix(ctx *context.Context, prefix string) (keys []string, err error)

GetKeysForPrefix implementation

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

func (ms *MongoStorage) GetRankingDrv(ctx *context.Context, tenant, id string) (*utils.Ranking, error)

func (*MongoStorage) GetRankingProfileDrv

func (ms *MongoStorage) GetRankingProfileDrv(ctx *context.Context, tenant, id string) (*utils.RankingProfile, error)

func (*MongoStorage) GetRateProfileDrv

func (ms *MongoStorage) GetRateProfileDrv(ctx *context.Context, tenant, id string) (*utils.RateProfile, error)

func (*MongoStorage) GetRateProfileRatesDrv

func (ms *MongoStorage) GetRateProfileRatesDrv(ctx *context.Context, tenant, profileID, rtPrfx string, needIDs bool) (rateIDs []string, rates []*utils.Rate, err error)

func (*MongoStorage) GetResourceDrv

func (ms *MongoStorage) GetResourceDrv(ctx *context.Context, tenant, id string) (*utils.Resource, error)

func (*MongoStorage) GetResourceProfileDrv

func (ms *MongoStorage) GetResourceProfileDrv(ctx *context.Context, tenant, id string) (*utils.ResourceProfile, error)

func (*MongoStorage) GetRouteProfileDrv

func (ms *MongoStorage) GetRouteProfileDrv(ctx *context.Context, tenant, id string) (*utils.RouteProfile, error)

func (*MongoStorage) GetSection

func (ms *MongoStorage) GetSection(ctx *context.Context, section string, val any) error

func (*MongoStorage) GetStatQueueDrv

func (ms *MongoStorage) GetStatQueueDrv(ctx *context.Context, tenant, id string) (*StatQueue, error)

GetStatQueueDrv retrieves a StoredStatQueue

func (*MongoStorage) GetStatQueueProfileDrv

func (ms *MongoStorage) GetStatQueueProfileDrv(ctx *context.Context, tenant string, id string) (*StatQueueProfile, error)

GetStatQueueProfileDrv retrieves a StatQueueProfile from dataDB

func (*MongoStorage) GetStorageType

func (ms *MongoStorage) GetStorageType() string

func (*MongoStorage) GetThresholdDrv

func (ms *MongoStorage) GetThresholdDrv(ctx *context.Context, tenant, id string) (*Threshold, error)

func (*MongoStorage) GetThresholdProfileDrv

func (ms *MongoStorage) GetThresholdProfileDrv(ctx *context.Context, tenant, ID string) (*ThresholdProfile, error)

GetThresholdProfileDrv retrieves a ThresholdProfile from dataDB

func (*MongoStorage) GetTrendDrv

func (ms *MongoStorage) GetTrendDrv(ctx *context.Context, tenant, id string) (*utils.Trend, error)

func (*MongoStorage) GetTrendProfileDrv

func (ms *MongoStorage) GetTrendProfileDrv(ctx *context.Context, tenant, id string) (*utils.TrendProfile, error)

func (*MongoStorage) GetVersions

func (ms *MongoStorage) GetVersions(itm string) (vrs Versions, err error)

func (*MongoStorage) HasDataDrv

func (ms *MongoStorage) HasDataDrv(ctx *context.Context, 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) RemRankingProfileDrv

func (ms *MongoStorage) RemRankingProfileDrv(ctx *context.Context, tenant, id string) (err error)

func (*MongoStorage) RemStatQueueDrv

func (ms *MongoStorage) RemStatQueueDrv(ctx *context.Context, tenant, id string) error

RemStatQueueDrv removes stored metrics for a StoredStatQueue

func (*MongoStorage) RemStatQueueProfileDrv

func (ms *MongoStorage) RemStatQueueProfileDrv(ctx *context.Context, tenant, id string) error

RemStatQueueProfileDrv removes a StatsQueue from dataDB

func (*MongoStorage) RemThresholdProfileDrv

func (ms *MongoStorage) RemThresholdProfileDrv(ctx *context.Context, tenant, id string) error

RemoveThresholdProfile removes a ThresholdProfile from dataDB/cache

func (*MongoStorage) RemTrendProfileDrv

func (ms *MongoStorage) RemTrendProfileDrv(ctx *context.Context, tenant, id string) (err error)

func (*MongoStorage) RemoveAccountDrv

func (ms *MongoStorage) RemoveAccountDrv(ctx *context.Context, tenant, id string) error

func (*MongoStorage) RemoveActionProfileDrv

func (ms *MongoStorage) RemoveActionProfileDrv(ctx *context.Context, tenant, id string) error

func (*MongoStorage) RemoveAttributeProfileDrv

func (ms *MongoStorage) RemoveAttributeProfileDrv(ctx *context.Context, tenant, id string) error

func (*MongoStorage) RemoveCDRs

func (ms *MongoStorage) RemoveCDRs(ctx *context.Context, qryFltr []*Filter) (err error)

RemoveCDRs removes CDRs from MongoDB based on provided query filters.

func (*MongoStorage) RemoveChargerProfileDrv

func (ms *MongoStorage) RemoveChargerProfileDrv(ctx *context.Context, tenant, id string) error

func (*MongoStorage) RemoveConfigSectionsDrv

func (ms *MongoStorage) RemoveConfigSectionsDrv(ctx *context.Context, nodeID string, sectionIDs []string) error

func (*MongoStorage) RemoveFilterDrv

func (ms *MongoStorage) RemoveFilterDrv(ctx *context.Context, tenant, id string) error

func (*MongoStorage) RemoveIPAllocationsDrv

func (ms *MongoStorage) RemoveIPAllocationsDrv(ctx *context.Context, tenant, id string) error

func (*MongoStorage) RemoveIPProfileDrv

func (ms *MongoStorage) RemoveIPProfileDrv(ctx *context.Context, tenant, id string) error

func (*MongoStorage) RemoveIndexesDrv

func (ms *MongoStorage) RemoveIndexesDrv(ctx *context.Context, idxItmType, tntCtx, idxKey string) error

RemoveIndexesDrv removes the indexes

func (*MongoStorage) RemoveLoadIDsDrv

func (ms *MongoStorage) RemoveLoadIDsDrv() error

func (*MongoStorage) RemoveRankingDrv

func (ms *MongoStorage) RemoveRankingDrv(ctx *context.Context, tenant, id string) error

func (*MongoStorage) RemoveRateProfileDrv

func (ms *MongoStorage) RemoveRateProfileDrv(ctx *context.Context, tenant, id string, rateIDs *[]string) (err error)

func (*MongoStorage) RemoveResourceDrv

func (ms *MongoStorage) RemoveResourceDrv(ctx *context.Context, tenant, id string) error

func (*MongoStorage) RemoveResourceProfileDrv

func (ms *MongoStorage) RemoveResourceProfileDrv(ctx *context.Context, tenant, id string) error

func (*MongoStorage) RemoveRouteProfileDrv

func (ms *MongoStorage) RemoveRouteProfileDrv(ctx *context.Context, tenant, id string) error

func (*MongoStorage) RemoveThresholdDrv

func (ms *MongoStorage) RemoveThresholdDrv(ctx *context.Context, tenant, id string) error

func (*MongoStorage) RemoveTrendDrv

func (ms *MongoStorage) RemoveTrendDrv(ctx *context.Context, tenant, id string) error

func (*MongoStorage) RemoveVersions

func (ms *MongoStorage) RemoveVersions(vrs Versions) (err error)

func (*MongoStorage) RewriteConfigDB

func (ms *MongoStorage) RewriteConfigDB() (err error)

Only intended for InternalDB

func (*MongoStorage) RewriteDataDB

func (ms *MongoStorage) RewriteDataDB() (err error)

Will rewrite every dump file of DataDB, only for InternalDB

func (*MongoStorage) RewriteStorDB

func (ms *MongoStorage) RewriteStorDB() (err error)

RewriteStorDB used only for InternalDB

func (*MongoStorage) SelectDatabase

func (ms *MongoStorage) SelectDatabase(dbName string) error

SelectDatabase selects the specified database.

func (*MongoStorage) SetAccountDrv

func (ms *MongoStorage) SetAccountDrv(ctx *context.Context, ap *utils.Account) error

func (*MongoStorage) SetActionProfileDrv

func (ms *MongoStorage) SetActionProfileDrv(ctx *context.Context, ap *utils.ActionProfile) error

func (*MongoStorage) SetAttributeProfileDrv

func (ms *MongoStorage) SetAttributeProfileDrv(ctx *context.Context, r *utils.AttributeProfile) error

func (*MongoStorage) SetCDR

func (ms *MongoStorage) SetCDR(ctx *context.Context, cdr *utils.CGREvent, allowUpdate bool) error

SetCDR inserts or updates a CDR in MongoDB. If a CDR with the same cdrID already exists and allowUpdate is true, it updates the existing CDR. If allowUpdate is false and a CDR with the same cdrID exists, it returns an EXISTS error.

func (*MongoStorage) SetChargerProfileDrv

func (ms *MongoStorage) SetChargerProfileDrv(ctx *context.Context, r *utils.ChargerProfile) error

func (*MongoStorage) SetConfigSectionsDrv

func (ms *MongoStorage) SetConfigSectionsDrv(ctx *context.Context, nodeID string, sectionsData map[string][]byte) error

func (*MongoStorage) SetFilterDrv

func (ms *MongoStorage) SetFilterDrv(ctx *context.Context, r *Filter) error

func (*MongoStorage) SetIPAllocationsDrv

func (ms *MongoStorage) SetIPAllocationsDrv(ctx *context.Context, ip *utils.IPAllocations) error

func (*MongoStorage) SetIPProfileDrv

func (ms *MongoStorage) SetIPProfileDrv(ctx *context.Context, ipp *utils.IPProfile) error

func (*MongoStorage) SetIndexesDrv

func (ms *MongoStorage) SetIndexesDrv(ctx *context.Context, 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(ctx *context.Context, loadIDs map[string]int64) error

func (*MongoStorage) SetRankingDrv

func (ms *MongoStorage) SetRankingDrv(ctx *context.Context, rn *utils.Ranking) error

func (*MongoStorage) SetRankingProfileDrv

func (ms *MongoStorage) SetRankingProfileDrv(ctx *context.Context, sgp *utils.RankingProfile) (err error)

func (*MongoStorage) SetRateProfileDrv

func (ms *MongoStorage) SetRateProfileDrv(ctx *context.Context, rpp *utils.RateProfile, optOverwrite bool) error

func (*MongoStorage) SetResourceDrv

func (ms *MongoStorage) SetResourceDrv(ctx *context.Context, r *utils.Resource) error

func (*MongoStorage) SetResourceProfileDrv

func (ms *MongoStorage) SetResourceProfileDrv(ctx *context.Context, rp *utils.ResourceProfile) error

func (*MongoStorage) SetRouteProfileDrv

func (ms *MongoStorage) SetRouteProfileDrv(ctx *context.Context, r *utils.RouteProfile) error

func (*MongoStorage) SetSection

func (ms *MongoStorage) SetSection(ctx *context.Context, section string, jsn any) (err error)

func (*MongoStorage) SetStatQueueDrv

func (ms *MongoStorage) SetStatQueueDrv(ctx *context.Context, ssq *StoredStatQueue, sq *StatQueue) (err error)

SetStatQueueDrv stores the metrics for a StoredStatQueue

func (*MongoStorage) SetStatQueueProfileDrv

func (ms *MongoStorage) SetStatQueueProfileDrv(ctx *context.Context, sq *StatQueueProfile) error

SetStatQueueProfileDrv stores a StatsQueue into DataDB

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(ctx *context.Context, r *Threshold) error

func (*MongoStorage) SetThresholdProfileDrv

func (ms *MongoStorage) SetThresholdProfileDrv(ctx *context.Context, tp *ThresholdProfile) error

SetThresholdProfileDrv stores a ThresholdProfile into DataDB

func (*MongoStorage) SetTrendDrv

func (ms *MongoStorage) SetTrendDrv(ctx *context.Context, tr *utils.Trend) error

func (*MongoStorage) SetTrendProfileDrv

func (ms *MongoStorage) SetTrendProfileDrv(ctx *context.Context, srp *utils.TrendProfile) (err error)

func (*MongoStorage) SetVersions

func (ms *MongoStorage) SetVersions(vrs Versions, overwrite bool) (err error)

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 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 RPCClientSet

type RPCClientSet map[string]chan birpc.ClientConnector

RPCClientSet is a RPC ClientConnector for the internal subsystems

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 RankingMdl

type RankingMdl 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 (RankingMdl) TableName

func (RankingMdl) TableName() string

type RankingMdls

type RankingMdls []*RankingMdl

func APItoModelTPRanking

func APItoModelTPRanking(tpRG *utils.TPRankingProfile) (mdls RankingMdls)

func (RankingMdls) AsTPRanking

func (models RankingMdls) AsTPRanking() (result []*utils.TPRankingProfile)

func (RankingMdls) CSVHeader

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

type RateProfileMdl

type RateProfileMdl struct {
	PK                  uint `gorm:"primary_key"`
	Tpid                string
	Tenant              string  `index:"0" re:".*"`
	ID                  string  `index:"1" re:".*"`
	FilterIDs           string  `index:"2" re:".*"`
	Weights             string  `index:"3" re:".*"`
	MinCost             float64 `index:"4"  re:".*"`
	MaxCost             float64 `index:"5"  re:".*"`
	MaxCostStrategy     string  `index:"6" re:".*"`
	RateID              string  `index:"7" re:".*"`
	RateFilterIDs       string  `index:"8" re:".*"`
	RateActivationTimes string  `index:"9" re:".*"`
	RateWeights         string  `index:"10" re:".*"`
	RateBlocker         bool    `index:"11" re:".*"`
	RateIntervalStart   string  `index:"12" re:".*"`
	RateFixedFee        float64 `index:"13" re:".*"`
	RateRecurrentFee    float64 `index:"14" re:".*"`
	RateUnit            string  `index:"15" re:".*"`
	RateIncrement       string  `index:"16" re:".*"`

	CreatedAt time.Time
}

func (RateProfileMdl) TableName

func (RateProfileMdl) TableName() string

type RateProfileMdls

type RateProfileMdls []*RateProfileMdl

RateProfileMdls is used

func APItoModelTPRateProfile

func APItoModelTPRateProfile(tPrf *utils.TPRateProfile) (mdls RateProfileMdls)

func (RateProfileMdls) AsTPRateProfile

func (tps RateProfileMdls) AsTPRateProfile() (result []*utils.TPRateProfile)

func (RateProfileMdls) CSVHeader

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

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

type RedisStorage

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

func NewRedisStorage

func NewRedisStorage(address string, db int, user, pass, mrshlerStr string,
	maxConns, attempts int, sentinelName string, isCluster bool, clusterSync,
	clusterOnDownDelay, connTimeout, readTimeout, writeTimeout time.Duration,
	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) BackupConfigDB

func (rs *RedisStorage) BackupConfigDB(backupFolderPath string, zip bool) (err error)

Only intended for InternalDB

func (*RedisStorage) BackupDataDB

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 function get a connection from the pool. Handles automatic failover in case of network disconnects

func (*RedisStorage) DumpConfigDB

func (rs *RedisStorage) DumpConfigDB() (err error)

Only intended for InternalDB

func (*RedisStorage) DumpDataDB

func (rs *RedisStorage) DumpDataDB() error

DumpDataDB will dump all of datadb from memory to a file, only for InternalDB

func (*RedisStorage) FlatCmd

func (rs *RedisStorage) FlatCmd(rcv any, cmd, key string, args ...any) error

FlatCmd function get a connection from the pool. Handles automatic failover in case of network disconnects

func (*RedisStorage) Flush

func (rs *RedisStorage) Flush(ignore string) error

func (*RedisStorage) GetAccountDrv

func (rs *RedisStorage) GetAccountDrv(ctx *context.Context, tenant, id string) (ap *utils.Account, err error)

func (*RedisStorage) GetActionProfileDrv

func (rs *RedisStorage) GetActionProfileDrv(ctx *context.Context, tenant, id string) (ap *utils.ActionProfile, err error)

func (*RedisStorage) GetAttributeProfileDrv

func (rs *RedisStorage) GetAttributeProfileDrv(ctx *context.Context, tenant, id string) (r *utils.AttributeProfile, err error)

func (*RedisStorage) GetChargerProfileDrv

func (rs *RedisStorage) GetChargerProfileDrv(_ *context.Context, tenant, id string) (r *utils.ChargerProfile, err error)

func (*RedisStorage) GetConfigSectionsDrv

func (rs *RedisStorage) GetConfigSectionsDrv(ctx *context.Context, nodeID string, sectionIDs []string) (sectionMap map[string][]byte, err error)

func (*RedisStorage) GetFilterDrv

func (rs *RedisStorage) GetFilterDrv(ctx *context.Context, tenant, id string) (r *Filter, err error)

func (*RedisStorage) GetIPAllocationsDrv

func (rs *RedisStorage) GetIPAllocationsDrv(ctx *context.Context, tenant, id string) (*utils.IPAllocations, error)

func (*RedisStorage) GetIPProfileDrv

func (rs *RedisStorage) GetIPProfileDrv(ctx *context.Context, tenant, id string) (*utils.IPProfile, error)

func (*RedisStorage) GetIndexesDrv

func (rs *RedisStorage) GetIndexesDrv(ctx *context.Context, idxItmType, tntCtx, idxKey, transactionID string) (indexes map[string]utils.StringSet, err error)

GetIndexesDrv retrieves Indexes from dataDB

func (*RedisStorage) GetItemLoadIDsDrv

func (rs *RedisStorage) GetItemLoadIDsDrv(ctx *context.Context, itemIDPrefix string) (loadIDs map[string]int64, err error)

func (*RedisStorage) GetKeysForPrefix

func (rs *RedisStorage) GetKeysForPrefix(ctx *context.Context, prefix string) (keys []string, err error)

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

func (rs *RedisStorage) GetRankingDrv(ctx *context.Context, tenant, id string) (rn *utils.Ranking, err error)

func (*RedisStorage) GetRankingProfileDrv

func (rs *RedisStorage) GetRankingProfileDrv(ctx *context.Context, tenant string, id string) (sg *utils.RankingProfile, err error)

func (*RedisStorage) GetRateProfileDrv

func (rs *RedisStorage) GetRateProfileDrv(ctx *context.Context, tenant, id string) (rpp *utils.RateProfile, err error)

func (*RedisStorage) GetRateProfileRatesDrv

func (rs *RedisStorage) GetRateProfileRatesDrv(ctx *context.Context, tnt, profileID, rtPrfx string, needIDs bool) (rateIDs []string, rates []*utils.Rate, err error)

GetRateProfileRateIDsDrv will return back all the rate IDs from a profile

func (*RedisStorage) GetResourceDrv

func (rs *RedisStorage) GetResourceDrv(ctx *context.Context, tenant, id string) (r *utils.Resource, err error)

func (*RedisStorage) GetResourceProfileDrv

func (rs *RedisStorage) GetResourceProfileDrv(ctx *context.Context, tenant, id string) (rsp *utils.ResourceProfile, err error)

func (*RedisStorage) GetRouteProfileDrv

func (rs *RedisStorage) GetRouteProfileDrv(ctx *context.Context, tenant, id string) (r *utils.RouteProfile, err error)

func (*RedisStorage) GetSection

func (rs *RedisStorage) GetSection(ctx *context.Context, section string, val any) (err error)

func (*RedisStorage) GetStatQueueDrv

func (rs *RedisStorage) GetStatQueueDrv(ctx *context.Context, tenant, id string) (sq *StatQueue, err error)

GetStatQueueDrv retrieves the stored metrics for a StatsQueue

func (*RedisStorage) GetStatQueueProfileDrv

func (rs *RedisStorage) GetStatQueueProfileDrv(ctx *context.Context, 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(ctx *context.Context, tenant, id string) (r *Threshold, err error)

func (*RedisStorage) GetThresholdProfileDrv

func (rs *RedisStorage) GetThresholdProfileDrv(ctx *context.Context, tenant, ID string) (tp *ThresholdProfile, err error)

GetThresholdProfileDrv retrieves a ThresholdProfile from dataDB

func (*RedisStorage) GetTrendDrv

func (rs *RedisStorage) GetTrendDrv(ctx *context.Context, tenant, id string) (r *utils.Trend, err error)

func (*RedisStorage) GetTrendProfileDrv

func (rs *RedisStorage) GetTrendProfileDrv(ctx *context.Context, tenant string, id string) (sg *utils.TrendProfile, err error)

func (*RedisStorage) GetVersions

func (rs *RedisStorage) GetVersions(itm string) (vrs Versions, err error)

func (*RedisStorage) HasDataDrv

func (rs *RedisStorage) HasDataDrv(ctx *context.Context, 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() utils.Marshaler

func (*RedisStorage) RemRankingProfileDrv

func (rs *RedisStorage) RemRankingProfileDrv(ctx *context.Context, tenant string, id string) (err error)

func (*RedisStorage) RemStatQueueDrv

func (rs *RedisStorage) RemStatQueueDrv(ctx *context.Context, tenant, id string) (err error)

RemStatQueueDrv removes a StatsQueue

func (*RedisStorage) RemStatQueueProfileDrv

func (rs *RedisStorage) RemStatQueueProfileDrv(ctx *context.Context, tenant, id string) (err error)

RemStatQueueProfileDrv removes a StatsQueue from dataDB

func (*RedisStorage) RemThresholdProfileDrv

func (rs *RedisStorage) RemThresholdProfileDrv(ctx *context.Context, tenant, id string) (err error)

RemThresholdProfileDrv removes a ThresholdProfile from dataDB/cache

func (*RedisStorage) RemTrendProfileDrv

func (rs *RedisStorage) RemTrendProfileDrv(ctx *context.Context, tenant string, id string) (err error)

func (*RedisStorage) RemoveAccountDrv

func (rs *RedisStorage) RemoveAccountDrv(ctx *context.Context, tenant, id string) (err error)

func (*RedisStorage) RemoveActionProfileDrv

func (rs *RedisStorage) RemoveActionProfileDrv(ctx *context.Context, tenant, id string) (err error)

func (*RedisStorage) RemoveAttributeProfileDrv

func (rs *RedisStorage) RemoveAttributeProfileDrv(ctx *context.Context, tenant, id string) (err error)

func (*RedisStorage) RemoveChargerProfileDrv

func (rs *RedisStorage) RemoveChargerProfileDrv(_ *context.Context, tenant, id string) (err error)

func (*RedisStorage) RemoveConfigSectionsDrv

func (rs *RedisStorage) RemoveConfigSectionsDrv(ctx *context.Context, nodeID string, sectionIDs []string) (err error)

func (*RedisStorage) RemoveFilterDrv

func (rs *RedisStorage) RemoveFilterDrv(ctx *context.Context, tenant, id string) (err error)

func (*RedisStorage) RemoveIPAllocationsDrv

func (rs *RedisStorage) RemoveIPAllocationsDrv(ctx *context.Context, tenant, id string) error

func (*RedisStorage) RemoveIPProfileDrv

func (rs *RedisStorage) RemoveIPProfileDrv(ctx *context.Context, tenant, id string) error

func (*RedisStorage) RemoveIndexesDrv

func (rs *RedisStorage) RemoveIndexesDrv(ctx *context.Context, idxItmType, tntCtx, idxKey string) (err error)

func (*RedisStorage) RemoveLoadIDsDrv

func (rs *RedisStorage) RemoveLoadIDsDrv() (err error)

func (*RedisStorage) RemoveRankingDrv

func (rs *RedisStorage) RemoveRankingDrv(ctx *context.Context, tenant, id string) (err error)

func (*RedisStorage) RemoveRateProfileDrv

func (rs *RedisStorage) RemoveRateProfileDrv(ctx *context.Context, tenant, id string, rateIDs *[]string) (err error)

func (*RedisStorage) RemoveResourceDrv

func (rs *RedisStorage) RemoveResourceDrv(ctx *context.Context, tenant, id string) (err error)

func (*RedisStorage) RemoveResourceProfileDrv

func (rs *RedisStorage) RemoveResourceProfileDrv(ctx *context.Context, tenant, id string) (err error)

func (*RedisStorage) RemoveRouteProfileDrv

func (rs *RedisStorage) RemoveRouteProfileDrv(ctx *context.Context, tenant, id string) (err error)

func (*RedisStorage) RemoveThresholdDrv

func (rs *RedisStorage) RemoveThresholdDrv(ctx *context.Context, tenant, id string) (err error)

func (*RedisStorage) RemoveTrendDrv

func (rs *RedisStorage) RemoveTrendDrv(ctx *context.Context, tenant, id string) (err error)

func (*RedisStorage) RemoveVersions

func (rs *RedisStorage) RemoveVersions(vrs Versions) (err error)

func (*RedisStorage) RewriteConfigDB

func (rs *RedisStorage) RewriteConfigDB() (err error)

Only intended for InternalDB

func (*RedisStorage) RewriteDataDB

func (rs *RedisStorage) RewriteDataDB() (err error)

Will rewrite every dump file of DataDB, only for InternalDB

func (*RedisStorage) SelectDatabase

func (rs *RedisStorage) SelectDatabase(dbName string) (err error)

func (*RedisStorage) SetAccountDrv

func (rs *RedisStorage) SetAccountDrv(ctx *context.Context, ap *utils.Account) (err error)

func (*RedisStorage) SetActionProfileDrv

func (rs *RedisStorage) SetActionProfileDrv(ctx *context.Context, ap *utils.ActionProfile) (err error)

func (*RedisStorage) SetAttributeProfileDrv

func (rs *RedisStorage) SetAttributeProfileDrv(ctx *context.Context, r *utils.AttributeProfile) (err error)

func (*RedisStorage) SetChargerProfileDrv

func (rs *RedisStorage) SetChargerProfileDrv(_ *context.Context, r *utils.ChargerProfile) (err error)

func (*RedisStorage) SetConfigSectionsDrv

func (rs *RedisStorage) SetConfigSectionsDrv(ctx *context.Context, nodeID string, sectionsData map[string][]byte) (err error)

func (*RedisStorage) SetFilterDrv

func (rs *RedisStorage) SetFilterDrv(ctx *context.Context, r *Filter) (err error)

func (*RedisStorage) SetIPAllocationsDrv

func (rs *RedisStorage) SetIPAllocationsDrv(ctx *context.Context, ip *utils.IPAllocations) error

func (*RedisStorage) SetIPProfileDrv

func (rs *RedisStorage) SetIPProfileDrv(ctx *context.Context, ipp *utils.IPProfile) error

func (*RedisStorage) SetIndexesDrv

func (rs *RedisStorage) SetIndexesDrv(ctx *context.Context, 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(ctx *context.Context, loadIDs map[string]int64) error

func (*RedisStorage) SetRankingDrv

func (rs *RedisStorage) SetRankingDrv(_ *context.Context, rn *utils.Ranking) (err error)

func (*RedisStorage) SetRankingProfileDrv

func (rs *RedisStorage) SetRankingProfileDrv(ctx *context.Context, sg *utils.RankingProfile) (err error)

func (*RedisStorage) SetRateProfileDrv

func (rs *RedisStorage) SetRateProfileDrv(ctx *context.Context, rpp *utils.RateProfile, optOverwrite bool) (err error)

func (*RedisStorage) SetResourceDrv

func (rs *RedisStorage) SetResourceDrv(ctx *context.Context, r *utils.Resource) (err error)

func (*RedisStorage) SetResourceProfileDrv

func (rs *RedisStorage) SetResourceProfileDrv(ctx *context.Context, rsp *utils.ResourceProfile) (err error)

func (*RedisStorage) SetRouteProfileDrv

func (rs *RedisStorage) SetRouteProfileDrv(ctx *context.Context, r *utils.RouteProfile) (err error)

func (*RedisStorage) SetSection

func (rs *RedisStorage) SetSection(_ *context.Context, section string, jsn any) (err error)

func (*RedisStorage) SetStatQueueDrv

func (rs *RedisStorage) SetStatQueueDrv(ctx *context.Context, ssq *StoredStatQueue, sq *StatQueue) (err error)

SetStatQueueDrv stores the metrics for a StatsQueue

func (*RedisStorage) SetStatQueueProfileDrv

func (rs *RedisStorage) SetStatQueueProfileDrv(ctx *context.Context, sq *StatQueueProfile) (err error)

SetStatQueueProfileDrv stores a StatsQueue into DataDB

func (*RedisStorage) SetThresholdDrv

func (rs *RedisStorage) SetThresholdDrv(ctx *context.Context, r *Threshold) (err error)

func (*RedisStorage) SetThresholdProfileDrv

func (rs *RedisStorage) SetThresholdProfileDrv(ctx *context.Context, tp *ThresholdProfile) (err error)

SetThresholdProfileDrv stores a ThresholdProfile into DataDB

func (*RedisStorage) SetTrendDrv

func (rs *RedisStorage) SetTrendDrv(ctx *context.Context, r *utils.Trend) (err error)

func (*RedisStorage) SetTrendProfileDrv

func (rs *RedisStorage) SetTrendProfileDrv(ctx *context.Context, sg *utils.TrendProfile) (err error)

func (*RedisStorage) SetVersions

func (rs *RedisStorage) SetVersions(vrs Versions, overwrite bool) (err error)

type ResourceMdl

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:".*"`
	Weights           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:".*"`
	ThresholdIDs      string `index:"9" re:".*"`
	CreatedAt         time.Time
}

func (ResourceMdl) TableName

func (ResourceMdl) TableName() string

type ResourceMdls

type ResourceMdls []*ResourceMdl

func APItoModelResource

func APItoModelResource(rl *utils.TPResourceProfile) (mdls ResourceMdls)

func (ResourceMdls) AsTPResources

func (tps ResourceMdls) AsTPResources() (result []*utils.TPResourceProfile)

func (ResourceMdls) CSVHeader

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

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

type ReverseFilterIHReply

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 RouteMdl

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:".*"`
	Weights             string `index:"3" re:".*"`
	Blockers            string `index:"4" re:".*"`
	Sorting             string `index:"5" re:".*"`
	SortingParameters   string `index:"6" re:".*"`
	RouteID             string `index:"7" re:".*"`
	RouteFilterIDs      string `index:"8" re:".*"`
	RouteAccountIDs     string `index:"9" re:".*"`
	RouteRateProfileIDs string `index:"10" re:".*"`
	RouteResourceIDs    string `index:"11" re:".*"`
	RouteStatIDs        string `index:"12" re:".*"`
	RouteWeights        string `index:"13" re:".*"`
	RouteBlockers       string `index:"14" re:".*"`
	RouteParameters     string `index:"15" re:".*"`
	CreatedAt           time.Time
}

func (RouteMdl) TableName

func (RouteMdl) TableName() string

type RouteMdls

type RouteMdls []*RouteMdl

func APItoModelTPRoutes

func APItoModelTPRoutes(st *utils.TPRouteProfile) (mdls RouteMdls)

func (RouteMdls) AsTPRouteProfile

func (tps RouteMdls) AsTPRouteProfile() (result []*utils.TPRouteProfile)

func (RouteMdls) CSVHeader

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

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

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 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,
	sslmode, sslcert, sslkey, sslpassword, sslcertmode, sslrootcert string,
	maxConn, maxIdleConn, sqlLogLevel int, connMaxLifetime time.Duration) (*SQLStorage, error)

NewPostgresStorage returns the posgres storDB

func (*SQLStorage) BackupStorDB

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

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(ctx *context.Context, qryFltr []*Filter, opts map[string]any) ([]*utils.CDR, error)

GetCDRs has ability to get the filtered CDRs, count them or simply return them qryFltr.Unscoped will ignore soft deletes or delete records permanently

func (*SQLStorage) GetKeysForPrefix

func (sqls *SQLStorage) GetKeysForPrefix(ctx *context.Context, prefix string) ([]string, error)

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) RemoveCDRs

func (sqls *SQLStorage) RemoveCDRs(ctx *context.Context, qryFltr []*Filter) (err error)

func (*SQLStorage) RemoveVersions

func (sqls *SQLStorage) RemoveVersions(vrs Versions) (err error)

RemoveVersions will remove specific versions out of storage

func (*SQLStorage) RewriteStorDB

func (sqls *SQLStorage) RewriteStorDB() (err error)

Will rewrite every dump file of StorDB, only for InternalDB

func (*SQLStorage) SelectDatabase

func (sqls *SQLStorage) SelectDatabase(dbName string) (err error)

func (*SQLStorage) SetCDR

func (sqls *SQLStorage) SetCDR(_ *context.Context, cdr *utils.CGREvent, allowUpdate bool) error

type SessionCostsSQL

type SessionCostsSQL struct {
	ID          int64
	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 StatACC

type StatACC struct {
	*Metric
}

ACC implements AverageCallCost metric

func (*StatACC) AddEvent

func (acc *StatACC) AddEvent(evID string, ev utils.DataProvider) error

func (*StatACC) AddOneEvent

func (acc *StatACC) AddOneEvent(ev utils.DataProvider) error

func (*StatACC) Clone

func (acc *StatACC) Clone() StatMetric

func (*StatACC) GetStringValue

func (acc *StatACC) GetStringValue(rounding int) string

func (*StatACC) GetValue

func (acc *StatACC) GetValue() *utils.Decimal

type StatACD

type StatACD struct {
	*Metric
}

ACD implements AverageCallDuration metric

func (*StatACD) AddEvent

func (acd *StatACD) AddEvent(evID string, ev utils.DataProvider) (err error)

func (*StatACD) AddOneEvent

func (acd *StatACD) AddOneEvent(ev utils.DataProvider) (err error)

func (*StatACD) Clone

func (acd *StatACD) Clone() StatMetric

func (*StatACD) GetStringValue

func (acd *StatACD) GetStringValue(rounding int) string

func (*StatACD) GetValue

func (acd *StatACD) GetValue() *utils.Decimal

type StatASR

type StatASR struct {
	*Metric
}

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

func (asr *StatASR) AddOneEvent(ev utils.DataProvider) (err error)

func (*StatASR) Clone

func (asr *StatASR) Clone() StatMetric

func (*StatASR) GetStringValue

func (asr *StatASR) GetStringValue(rounding int) (valStr string)

func (*StatASR) GetValue

func (asr *StatASR) GetValue() (val *utils.Decimal)

func (*StatASR) RemEvent

func (asr *StatASR) RemEvent(evID string) (err error)

type StatAverage

type StatAverage struct {
	*Metric
	FieldName string
}

StatAverage implements TotalCallCost metric

func (*StatAverage) AddEvent

func (avg *StatAverage) AddEvent(evID string, ev utils.DataProvider) error

func (*StatAverage) AddOneEvent

func (avg *StatAverage) AddOneEvent(ev utils.DataProvider) error

func (*StatAverage) Clone

func (avg *StatAverage) Clone() StatMetric

func (*StatAverage) GetStringValue

func (avg *StatAverage) GetStringValue(rounding int) string

func (*StatAverage) GetValue

func (avg *StatAverage) GetValue() *utils.Decimal

type StatDDC

type StatDDC struct {
	FieldValues map[string]utils.StringSet   // map[fieldValue]map[eventID]
	Events      map[string]map[string]uint64 // map[EventTenantID]map[fieldValue]compressfactor
	MinItems    uint64
	Count       uint64
	FilterIDs   []string
}

StatDDC count values occurring in destination field

func (*StatDDC) AddEvent

func (ddc *StatDDC) AddEvent(evID string, ev utils.DataProvider) (err error)

func (*StatDDC) AddOneEvent

func (ddc *StatDDC) AddOneEvent(ev utils.DataProvider) (err error)

func (*StatDDC) Clone

func (ddc *StatDDC) Clone() StatMetric

func (*StatDDC) Compress

func (ddc *StatDDC) Compress(queueLen uint64, defaultID string) (eventIDs []string)

func (*StatDDC) GetCompressFactor

func (ddc *StatDDC) GetCompressFactor(events map[string]uint64) map[string]uint64

Compress is part of StatMetric interface

func (*StatDDC) GetFilterIDs

func (ddc *StatDDC) GetFilterIDs() []string

func (*StatDDC) GetMinItems

func (ddc *StatDDC) GetMinItems() (minIts uint64)

GetMinItems returns the minim items for the metric

func (*StatDDC) GetStringValue

func (ddc *StatDDC) GetStringValue(rounding int) (valStr string)

func (*StatDDC) GetValue

func (ddc *StatDDC) GetValue() *utils.Decimal

func (*StatDDC) RemEvent

func (ddc *StatDDC) RemEvent(evID string) (err error)

type StatDistinct

type StatDistinct struct {
	FieldValues map[string]utils.StringSet   // map[fieldValue]map[eventID]
	Events      map[string]map[string]uint64 // map[EventTenantID]map[fieldValue]compressfactor
	MinItems    uint64
	FieldName   string
	Count       uint64
	FilterIDs   []string
}

func (*StatDistinct) AddEvent

func (dst *StatDistinct) AddEvent(evID string, ev utils.DataProvider) (err error)

func (*StatDistinct) AddOneEvent

func (dst *StatDistinct) AddOneEvent(ev utils.DataProvider) (err error)

func (*StatDistinct) Clone

func (dst *StatDistinct) Clone() StatMetric

func (*StatDistinct) Compress

func (dst *StatDistinct) Compress(uint64, string) (eventIDs []string)

func (*StatDistinct) GetCompressFactor

func (dst *StatDistinct) GetCompressFactor(events map[string]uint64) map[string]uint64

Compress is part of StatMetric interface

func (*StatDistinct) GetFilterIDs

func (dst *StatDistinct) GetFilterIDs() []string

func (*StatDistinct) GetMinItems

func (dst *StatDistinct) GetMinItems() uint64

GetMinItems returns the minim items for the metric

func (*StatDistinct) GetStringValue

func (dst *StatDistinct) GetStringValue(rounding int) (valStr string)

func (*StatDistinct) GetValue

func (dst *StatDistinct) GetValue() *utils.Decimal

func (*StatDistinct) RemEvent

func (dst *StatDistinct) RemEvent(evID string) (err error)

type StatMdl

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:".*"`
	Weights         string `index:"3" re:".*"`
	Blockers        string `index:"4" re:".*"`
	QueueLength     int    `index:"5" re:".*"`
	TTL             string `index:"6" re:".*"`
	MinItems        int    `index:"7" re:".*"`
	Stored          bool   `index:"8" re:".*"`
	ThresholdIDs    string `index:"9" re:".*"`
	MetricIDs       string `index:"10" re:".*"`
	MetricFilterIDs string `index:"11" re:".*"`
	MetricBlockers  string `index:"12" re:".*"`
	CreatedAt       time.Time
}

func (StatMdl) TableName

func (StatMdl) TableName() string

type StatMdls

type StatMdls []*StatMdl

func APItoModelStats

func APItoModelStats(st *utils.TPStatProfile) (mdls StatMdls)

func (StatMdls) AsTPStats

func (tps StatMdls) AsTPStats() (result []*utils.TPStatProfile)

func (StatMdls) CSVHeader

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

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

type StatMetric

type StatMetric interface {
	GetValue() *utils.Decimal
	GetStringValue(rounding int) string
	AddOneEvent(ev utils.DataProvider) error
	AddEvent(evID string, ev utils.DataProvider) error
	RemEvent(evID string) error
	GetMinItems() (minIts uint64)
	Compress(queueLen uint64, defaultID string) (eventIDs []string)
	GetCompressFactor(events map[string]uint64) map[string]uint64
	Clone() StatMetric
	GetFilterIDs() []string
}

StatMetric is the interface which a metric should implement

func NewACC

func NewACC(minItems uint64, _ string, filterIDs []string) StatMetric

func NewACD

func NewACD(minItems uint64, _ string, filterIDs []string) StatMetric

func NewASR

func NewASR(minItems uint64, _ string, filterIDs []string) StatMetric

func NewDDC

func NewDDC(minItems uint64, _ string, filterIDs []string) StatMetric

func NewPDD

func NewPDD(minItems uint64, _ string, filterIDs []string) StatMetric

func NewStatAverage

func NewStatAverage(minItems uint64, fieldName string, filterIDs []string) StatMetric

func NewStatDistinct

func NewStatDistinct(minItems uint64, fieldName string, filterIDs []string) StatMetric

StatDistinct counts the different values occurring in a specific event field

func NewStatMetric

func NewStatMetric(metricID string, minItems uint64, filterIDs []string) (sm StatMetric, err error)

NewStatMetric instantiates the StatMetric cfg serves as general purpose container to pass config options to metric

func NewStatSum

func NewStatSum(minItems uint64, fieldName string, filterIDs []string) StatMetric

func NewTCC

func NewTCC(minItems uint64, _ string, filterIDs []string) StatMetric

func NewTCD

func NewTCD(minItems uint64, _ string, filterIDs []string) StatMetric

type StatPDD

type StatPDD struct {
	*Metric
}

PDD implements Post Dial Delay (average) metric

func (*StatPDD) AddEvent

func (pdd *StatPDD) AddEvent(evID string, ev utils.DataProvider) error

func (*StatPDD) AddOneEvent

func (pdd *StatPDD) AddOneEvent(ev utils.DataProvider) error

func (*StatPDD) Clone

func (pdd *StatPDD) Clone() StatMetric

func (*StatPDD) GetStringValue

func (pdd *StatPDD) GetStringValue(rounding int) string

func (*StatPDD) GetValue

func (pdd *StatPDD) GetValue() *utils.Decimal

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

func NewStatQueue(tnt, id string, metrics []*MetricWithFilters, minItems uint64) (sq *StatQueue, err error)

func (*StatQueue) CacheClone

func (sq *StatQueue) CacheClone() any

CacheClone returns a clone of StatQueue used by ltcache CacheCloner

func (*StatQueue) Clone

func (sq *StatQueue) Clone() (cln *StatQueue)

func (*StatQueue) Compress

func (sq *StatQueue) Compress(maxQL uint64) bool

func (*StatQueue) Expand

func (sq *StatQueue) Expand()

func (*StatQueue) GobDecode

func (sq *StatQueue) GobDecode(rply []byte) (err error)

func (StatQueue) GobEncode

func (sq StatQueue) GobEncode() (rply []byte, err error)

func (*StatQueue) MarshalJSON

func (sq *StatQueue) MarshalJSON() (rply []byte, err error)

func (*StatQueue) ProcessEvent

func (sq *StatQueue) ProcessEvent(ctx *context.Context, tnt, evID string, filterS *FilterS, evNm utils.MapStorage) (err 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

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
	Weights      utils.DynamicWeights
	Blockers     utils.DynamicBlockers // blocker flag to stop processing on filters matched
	QueueLength  int
	TTL          time.Duration
	MinItems     int
	Stored       bool
	ThresholdIDs []string             // list of thresholds to be checked after changes
	Metrics      []*MetricWithFilters // list of metrics to build
	// 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

func (sqp *StatQueueProfile) CacheClone() any

CacheClone returns a clone of StatQueueProfile used by ltcache CacheCloner

func (*StatQueueProfile) Clone

func (sqp *StatQueueProfile) Clone() *StatQueueProfile

Clone clones *StatQueueProfile (lkID excluded)

func (*StatQueueProfile) FieldAsInterface

func (sqp *StatQueueProfile) FieldAsInterface(fldPath []string) (_ any, err error)

func (*StatQueueProfile) FieldAsString

func (sqp *StatQueueProfile) FieldAsString(fldPath []string) (_ string, err error)

func (*StatQueueProfile) Merge

func (sqp *StatQueueProfile) Merge(v2 any)

func (*StatQueueProfile) Set

func (sqp *StatQueueProfile) Set(path []string, val any, newBranch bool) (err error)

func (*StatQueueProfile) String

func (sqp *StatQueueProfile) String() string

func (*StatQueueProfile) TenantID

func (sqp *StatQueueProfile) TenantID() string

type StatQueueProfileWithAPIOpts

type StatQueueProfileWithAPIOpts struct {
	*StatQueueProfile
	APIOpts map[string]any
}

StatQueueProfileWithAPIOpts is used in replicatorV1 for dispatcher

type StatQueueWithAPIOpts

type StatQueueWithAPIOpts struct {
	StatQueue *StatQueue
	APIOpts   map[string]any
}

func (*StatQueueWithAPIOpts) MarshalJSON

func (ssq *StatQueueWithAPIOpts) MarshalJSON() (rply []byte, err error)

func (*StatQueueWithAPIOpts) UnmarshalJSON

func (ssq *StatQueueWithAPIOpts) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON here only to fully support json for StatQueue

type StatS

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

StatS builds stats for events

func NewStatService

func NewStatService(dm *DataManager, cgrcfg *config.CGRConfig,
	filterS *FilterS, connMgr *ConnManager) *StatS

NewStatService initializes a StatService

func (*StatS) Reload

func (sS *StatS) Reload(ctx *context.Context)

Reload stops the backupLoop and restarts it

func (*StatS) Shutdown

func (sS *StatS) Shutdown(ctx *context.Context)

Shutdown is called to shutdown the service

func (*StatS) StartLoop

func (sS *StatS) StartLoop(ctx *context.Context)

StartLoop starsS the gorutine with the backup loop

func (*StatS) StoreStatQueue

func (sS *StatS) StoreStatQueue(ctx *context.Context, sq *StatQueue) (err error)

StoreStatQueue stores the statQueue in DB and corrects dirty flag

func (*StatS) V1GetQueueDecimalMetrics

func (sS *StatS) V1GetQueueDecimalMetrics(ctx *context.Context, args *utils.TenantIDWithAPIOpts, reply *map[string]*utils.Decimal) (err error)

V1GetQueueDecimalMetrics returns the metrics as decimal values

func (*StatS) V1GetQueueFloatMetrics

func (sS *StatS) V1GetQueueFloatMetrics(ctx *context.Context, args *utils.TenantIDWithAPIOpts, reply *map[string]float64) (err error)

V1GetQueueFloatMetrics returns the metrics as float64 values

func (*StatS) V1GetQueueIDs

func (sS *StatS) V1GetQueueIDs(ctx *context.Context, args *utils.TenantWithAPIOpts, qIDs *[]string) (err error)

V1GetQueueIDs returns list of queueIDs registered for a tenant

func (*StatS) V1GetQueueStringMetrics

func (sS *StatS) V1GetQueueStringMetrics(ctx *context.Context, args *utils.TenantIDWithAPIOpts, reply *map[string]string) (err error)

V1GetQueueStringMetrics returns the metrics of a Queue as string values

func (*StatS) V1GetStatQueue

func (sS *StatS) V1GetStatQueue(ctx *context.Context, args *utils.TenantIDWithAPIOpts, reply *StatQueue) (err error)

V1GetStatQueue returns a StatQueue object

func (*StatS) V1GetStatQueuesForEvent

func (sS *StatS) V1GetStatQueuesForEvent(ctx *context.Context, args *utils.CGREvent, reply *[]string) (err error)

V1GetStatQueuesForEvent implements StatV1 method for processing an Event

func (*StatS) V1ProcessEvent

func (sS *StatS) V1ProcessEvent(ctx *context.Context, args *utils.CGREvent, reply *[]string) (err error)

V1ProcessEvent implements StatV1 method for processing an Event

func (*StatS) V1ResetStatQueue

func (sS *StatS) V1ResetStatQueue(ctx *context.Context, tntID *utils.TenantIDWithAPIOpts, rply *string) (err error)

V1ResetStatQueue resets the stat queue

type StatSum

type StatSum struct {
	*Metric
	FieldName string
}

func (*StatSum) AddEvent

func (sum *StatSum) AddEvent(evID string, ev utils.DataProvider) error

func (*StatSum) AddOneEvent

func (sum *StatSum) AddOneEvent(ev utils.DataProvider) error

func (*StatSum) Clone

func (sum *StatSum) Clone() StatMetric

type StatTCC

type StatTCC struct {
	*Metric
}

TCC implements TotalCallCost metric

func (*StatTCC) AddEvent

func (tcc *StatTCC) AddEvent(evID string, ev utils.DataProvider) error

func (*StatTCC) AddOneEvent

func (tcc *StatTCC) AddOneEvent(ev utils.DataProvider) error

func (*StatTCC) Clone

func (tcc *StatTCC) Clone() StatMetric

type StatTCD

type StatTCD struct {
	*Metric
}

TCD implements TotalCallDuration metric

func (*StatTCD) AddEvent

func (sum *StatTCD) AddEvent(evID string, ev utils.DataProvider) (err error)

func (*StatTCD) AddOneEvent

func (sum *StatTCD) AddOneEvent(ev utils.DataProvider) (err error)

func (*StatTCD) Clone

func (sum *StatTCD) Clone() StatMetric

func (*StatTCD) GetStringValue

func (sum *StatTCD) GetStringValue(rounding int) string

type StorDB

type StorDB interface {
	Storage
	SetCDR(*context.Context, *utils.CGREvent, bool) error
	GetCDRs(*context.Context, []*Filter, map[string]any) ([]*utils.CDR, error)
	RemoveCDRs(*context.Context, []*Filter) error
	DumpStorDB() error
	RewriteStorDB() error
	BackupStorDB(string, bool) error
}

func NewStorDBConn

func NewStorDBConn(dbType, host, port, name, user, pass, marshaler string,
	stringIndexedFields, prefixIndexedFields []string,
	opts *config.StorDBOpts, itmsCfg map[string]*config.ItemOpts) (db StorDB, err error)

NewStorDBConn returns a StorDB(implements Storage interface) based on dbType

type Storage

type Storage interface {
	Close()
	Flush(string) error
	GetKeysForPrefix(ctx *context.Context, prefix string) ([]string, error)
	GetVersions(itm string) (vrs Versions, err error)
	SetVersions(vrs Versions, overwrite bool) (err error)
	RemoveVersions(vrs Versions) (err error)
	SelectDatabase(dbName string) (err error)
	GetStorageType() string
	IsDBEmpty() (resp bool, err error)
}

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 utils.Marshaler) (sSQ *StoredStatQueue, err error)

NewStoredStatQueue initiates a StoredStatQueue out of StatQueue

func (*StoredStatQueue) AsStatQueue

func (ssq *StoredStatQueue) AsStatQueue(ms utils.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 TBLVersion

type TBLVersion struct {
	ID      uint
	Item    string
	Version int64
}

func (TBLVersion) TableName

func (t TBLVersion) TableName() 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

func (t *Threshold) CacheClone() any

CacheClone returns a clone of Threshold used by ltcache CacheCloner

func (*Threshold) Clone

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 ThresholdMdl

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:".*"`
	Weights          string `index:"3" re:".*"`
	MaxHits          int    `index:"4" re:".*"`
	MinHits          int    `index:"5" re:".*"`
	MinSleep         string `index:"6" re:".*"`
	Blocker          bool   `index:"7" re:".*"`
	ActionProfileIDs string `index:"8" re:".*"`
	Async            bool   `index:"9" re:".*"`
	CreatedAt        time.Time
}

func (ThresholdMdl) TableName

func (ThresholdMdl) TableName() string

type ThresholdMdls

type ThresholdMdls []*ThresholdMdl

func APItoModelTPThreshold

func APItoModelTPThreshold(th *utils.TPThresholdProfile) (mdls ThresholdMdls)

func (ThresholdMdls) AsTPThreshold

func (tps ThresholdMdls) AsTPThreshold() (result []*utils.TPThresholdProfile)

func (ThresholdMdls) CSVHeader

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
	MaxHits          int
	MinHits          int
	MinSleep         time.Duration
	Blocker          bool                 // blocker flag to stop processing on filters matched
	Weights          utils.DynamicWeights // Weight to sort the thresholds
	ActionProfileIDs []string
	Async            bool
	// 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

func (tp *ThresholdProfile) CacheClone() any

CacheClone returns a clone of ThresholdProfile used by ltcache CacheCloner

func (*ThresholdProfile) Clone

func (tp *ThresholdProfile) Clone() *ThresholdProfile

Clone clones *ThresholdProfile (lkID excluded)

func (*ThresholdProfile) FieldAsInterface

func (tp *ThresholdProfile) FieldAsInterface(fldPath []string) (_ any, err error)

func (*ThresholdProfile) FieldAsString

func (tp *ThresholdProfile) FieldAsString(fldPath []string) (_ string, err error)

func (*ThresholdProfile) Merge

func (tp *ThresholdProfile) Merge(v2 any)

func (*ThresholdProfile) Set

func (tp *ThresholdProfile) Set(path []string, val any, _ bool) (err error)

func (*ThresholdProfile) String

func (tp *ThresholdProfile) String() string

func (*ThresholdProfile) TenantID

func (tp *ThresholdProfile) TenantID() string

TenantID returns the concatenated key beteen tenant and ID

type ThresholdProfileWithAPIOpts

type ThresholdProfileWithAPIOpts struct {
	*ThresholdProfile
	APIOpts map[string]any
}

ThresholdProfileWithAPIOpts is used in replicatorV1 for dispatcher

type ThresholdS

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

ThresholdS manages Threshold execution and storing them to dataDB

func NewThresholdService

func NewThresholdService(dm *DataManager, cgrcfg *config.CGRConfig, filterS *FilterS, connMgr *ConnManager) (tS *ThresholdS)

NewThresholdService the constructor for ThresoldS service

func (*ThresholdS) Reload

func (tS *ThresholdS) Reload(ctx *context.Context)

Reload stops the backupLoop and restarts it

func (*ThresholdS) Shutdown

func (tS *ThresholdS) Shutdown(ctx *context.Context)

Shutdown is called to shutdown the service

func (*ThresholdS) StartLoop

func (tS *ThresholdS) StartLoop(ctx *context.Context)

StartLoop starts the gorutine with the backup loop

func (*ThresholdS) StoreThreshold

func (tS *ThresholdS) StoreThreshold(ctx *context.Context, t *Threshold) (err error)

StoreThreshold stores the threshold in DB and corrects dirty flag

func (*ThresholdS) V1GetThreshold

func (tS *ThresholdS) V1GetThreshold(ctx *context.Context, tntID *utils.TenantIDWithAPIOpts, t *Threshold) (err error)

V1GetThreshold retrieves a Threshold

func (*ThresholdS) V1GetThresholdIDs

func (tS *ThresholdS) V1GetThresholdIDs(ctx *context.Context, args *utils.TenantWithAPIOpts, tIDs *[]string) (err error)

V1GetThresholdIDs returns list of thresholdIDs configured for a tenant

func (*ThresholdS) V1GetThresholdsForEvent

func (tS *ThresholdS) V1GetThresholdsForEvent(ctx *context.Context, args *utils.CGREvent, reply *[]*Threshold) (err error)

V1GetThresholdsForEvent queries thresholds matching an Event

func (*ThresholdS) V1ProcessEvent

func (tS *ThresholdS) V1ProcessEvent(ctx *context.Context, args *utils.CGREvent, reply *[]string) (err error)

V1ProcessEvent implements ThresholdService method for processing an Event

func (*ThresholdS) V1ResetThreshold

func (tS *ThresholdS) V1ResetThreshold(ctx *context.Context, tntID *utils.TenantIDWithAPIOpts, rply *string) (err error)

V1ResetThreshold resets the threshold hits

type ThresholdWithAPIOpts

type ThresholdWithAPIOpts struct {
	*Threshold
	APIOpts map[string]any
}

ThresholdWithAPIOpts is used in replicatorV1 for dispatcher

type TpReader

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

func NewTpReader

func NewTpReader(db DataDB, lr LoadReader, tpid, timezone string,
	cacheConns, schedulerConns []string, isInternalDB bool) (*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) LoadAccounts

func (tpr *TpReader) LoadAccounts() error

func (*TpReader) LoadAccountsFiltered

func (tpr *TpReader) LoadAccountsFiltered(tag string) (err error)

func (*TpReader) LoadActionProfiles

func (tpr *TpReader) LoadActionProfiles() error

func (*TpReader) LoadActionProfilesFiltered

func (tpr *TpReader) LoadActionProfilesFiltered(tag string) (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) LoadFilters

func (tpr *TpReader) LoadFilters() error

func (*TpReader) LoadFiltersFiltered

func (tpr *TpReader) LoadFiltersFiltered(tag string) error

func (*TpReader) LoadRankings

func (tpr *TpReader) LoadRankings() error

func (*TpReader) LoadRankingsFiltered

func (tpr *TpReader) LoadRankingsFiltered(tag string) error

func (*TpReader) LoadRateProfiles

func (tpr *TpReader) LoadRateProfiles() error

func (*TpReader) LoadRateProfilesFiltered

func (tpr *TpReader) LoadRateProfilesFiltered(tag string) (err error)

func (*TpReader) LoadResourceProfiles

func (tpr *TpReader) LoadResourceProfiles() error

func (*TpReader) LoadResourceProfilesFiltered

func (tpr *TpReader) LoadResourceProfilesFiltered(tag string) (err error)

func (*TpReader) LoadRouteProfiles

func (tpr *TpReader) LoadRouteProfiles() error

func (*TpReader) LoadRouteProfilesFiltered

func (tpr *TpReader) LoadRouteProfilesFiltered(tag string) (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) LoadTrends

func (tpr *TpReader) LoadTrends() error

func (*TpReader) LoadTrendsFiltered

func (tpr *TpReader) LoadTrendsFiltered(tag string) error

func (*TpReader) ReloadCache

func (tpr *TpReader) ReloadCache(ctx *context.Context, 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 TrendMdl

type TrendMdl 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 (TrendMdl) TableName

func (TrendMdl) TableName() string

type TrendMdls

type TrendMdls []*TrendMdl

func APItoModelTrends

func APItoModelTrends(tr *utils.TPTrendsProfile) (mdls TrendMdls)

func (TrendMdls) AsTPTrends

func (models TrendMdls) AsTPTrends() (result []*utils.TPTrendsProfile)

func (TrendMdls) CSVHeader

func (tps TrendMdls) CSVHeader() (result []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

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

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL