rulesengine

package
v4.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2026 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExcludeBiddersName = "excludeBidders"
	IncludeBiddersName = "includeBidders"
)

Variables

This section is empty.

Functions

func Builder

func Builder(cfg json.RawMessage, deps moduledeps.ModuleDeps) (interface{}, error)

Builder configures the rules engine module initiating an in-memory cache and kicking off a go routine that builds tree structures that represent rule sets optimized for finding a rule to applies for a given request.

func NewBidderConfigRuleSetBuilder

func NewBidderConfigRuleSetBuilder[T1 RequestWrapper, T2 ProcessedAuctionHookResult](
	geoscopeConfig map[string][]string, setDefinitions map[string][]string,
) *bidderConfigRuleSetBuilder[T1, T2]

NewBidderConfigRuleSetBuilder creates a new instance of bidderConfigRuleSetBuilder

func NewCache

func NewCache(refreshRateSeconds int) *cache

func NewCacheEntry

func NewCacheEntry(cfg *config.PbRulesEngine, cfgRaw *json.RawMessage, geoscopes map[string][]string) (cacheEntry, error)

NewCacheEntry creates a new cache object for the given configuration It builds the tree structures for the rule sets for the processed auction request stage and stores them in the cache object

Types

type CountryExclusions

type CountryExclusions = map[string][]string

type CountryGroups

type CountryGroups = map[string][]string

type ExcludeBidders

type ExcludeBidders struct {
	Args config.ResultFuncParams
}

ExcludeBidders is a struct that holds parameters for excluding bidders in the rules engine.

func (*ExcludeBidders) Call

Call is a method that applies the changes specified in the ExcludeBidders instance to the provided ChangeSet by creating a mutation.

func (*ExcludeBidders) Name

func (eb *ExcludeBidders) Name() string

type IncludeBidders

type IncludeBidders struct {
	Args config.ResultFuncParams
}

IncludeBidders is a struct that holds parameters for including bidders in the rules engine.

func (*IncludeBidders) Call

Call is a method that applies the changes specified in the IncludeBidders instance to the provided ChangeSet by creating a mutation.

func (*IncludeBidders) Name

func (ib *IncludeBidders) Name() string

type ModelGroup

type ModelGroup = cacheModelGroup[RequestWrapper, ProcessedAuctionHookResult]

type Module

type Module struct {
	Cache       cacher
	TreeManager *treeManager
}

Module represents the rules engine module

func (Module) HandleProcessedAuctionHook

HandleProcessedAuctionHook updates field on openrtb2.BidRequest. Fields are updated only if request satisfies conditions provided by the module config.

func (Module) Shutdown

func (m Module) Shutdown()

Shutdown signals the module to stop processing and waits for the tree manager to finish processing any remaining build instructions in the channel.

type ProcessedAuctionHookResult

type ProcessedAuctionHookResult struct {
	HookResult     hs.HookResult[hs.ProcessedAuctionRequestPayload]
	AllowedBidders map[string]struct{}
}

type ProcessedAuctionResultFunc

ProcessedAuctionResultFunc is a type alias for a result function that runs in the processed auction request stage.

func NewExcludeBidders

func NewExcludeBidders(params json.RawMessage) (ProcessedAuctionResultFunc, error)

NewExcludeBidders is a factory function that creates a new ExcludeBidders result function. It takes a JSON raw message as input, unmarshals it into a slice of ResultFuncParams, and returns an ExcludeBidders instance. The function returns an error if there is an issue with the unmarshalling process. The ExcludeBidders function is used to modify the ProcessedAuctionRequestPayload in the ChangeSet.

func NewIncludeBidders

func NewIncludeBidders(params json.RawMessage) (ProcessedAuctionResultFunc, error)

NewIncludeBidders is a factory function that creates a new IncludeBidders result function. It takes a JSON raw message as input, unmarshals it into a slice of ResultFuncParams, and returns an IncludeBidders instance. The function returns an error if there is an issue with the unmarshalling process. The IncludeBidders function is used to modify the ProcessedAuctionRequestPayload in the ChangeSet.

func NewProcessedAuctionRequestResultFunction

func NewProcessedAuctionRequestResultFunction(name string, params json.RawMessage) (ProcessedAuctionResultFunc, error)

NewProcessedAuctionRequestResultFunction is a factory function that creates a new result function based on the provided name and parameters. It returns an error if the function name is not recognized or if there is an issue with the parameters. The function name is case insensitive. The parameters are expected to be in JSON format and will be unmarshalled into the appropriate struct. The function returns a rules.ResultFunction that can be used to modify the ProcessedAuctionRequestPayload in the ChangeSet. The function is used to create result functions for the rules engine in the Prebid Server.

type RequestWrapper

type RequestWrapper = openrtb_ext.RequestWrapper

type RulesEngineObserver

type RulesEngineObserver interface {
	// contains filtered or unexported methods
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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