Documentation
¶
Index ¶
- Variables
- type Metrics
- type MultisourceWrapper
- func (wrp *MultisourceWrapper) AccountID() uint64
- func (wrp *MultisourceWrapper) Bid(request adtype.BidRequester) (response adtype.Response)
- func (wrp *MultisourceWrapper) ID() uint64
- func (wrp *MultisourceWrapper) Info() *adtype.SourceInfo
- func (wrp *MultisourceWrapper) ObjectKey() uint64
- func (wrp *MultisourceWrapper) PriceCorrectionReduceFactor() float64
- func (wrp *MultisourceWrapper) ProcessResponse(response adtype.Response)
- func (wrp *MultisourceWrapper) ProcessResponseItem(response adtype.Response, ad adtype.ResponseItem)
- func (wrp *MultisourceWrapper) Protocol() string
- func (wrp *MultisourceWrapper) RevenueShareReduceFactor() float64
- func (wrp *MultisourceWrapper) ServersCount() int
- func (wrp *MultisourceWrapper) SetRequestTimeout(ctx context.Context, timeout time.Duration)
- func (wrp *MultisourceWrapper) Sources() adtype.SourceAccessor
- func (wrp *MultisourceWrapper) Test(request adtype.BidRequester) error
- type Option
- type ResponsePreprocessor
- type SourceError
Constants ¶
This section is empty.
Variables ¶
var (
ErrSourcesCantBeNil = errors.New("[SSP] seurces can`t be nil")
)
Error set...
Functions ¶
This section is empty.
Types ¶
type Metrics ¶
type Metrics struct {
// contains filtered or unexported fields
}
Metrics wrapper
func (*Metrics) IncrementBidErrorCount ¶
func (m *Metrics) IncrementBidErrorCount(source adtype.Source, request adtype.BidRequester, err error)
IncrementBidErrorCount metric
func (*Metrics) IncrementBidRequestCount ¶
func (m *Metrics) IncrementBidRequestCount(source adtype.Source, request adtype.BidRequester, duration time.Duration)
IncrementBidRequestCount metric
type MultisourceWrapper ¶
type MultisourceWrapper struct {
// contains filtered or unexported fields
}
MultisourceWrapper describes the abstraction which can control where to send requests and how to handle responses from different sources.
func NewMultisourceWrapper ¶
func NewMultisourceWrapper(options ...Option) (*MultisourceWrapper, error)
NewMultisourceWrapper initializes a new MultisourceWrapper with the given options
func (*MultisourceWrapper) AccountID ¶
func (wrp *MultisourceWrapper) AccountID() uint64
AccountID returns the account ID of the source driver
func (*MultisourceWrapper) Bid ¶
func (wrp *MultisourceWrapper) Bid(request adtype.BidRequester) (response adtype.Response)
Bid handles a bid request and processes it through the appropriate sources
func (*MultisourceWrapper) ID ¶
func (wrp *MultisourceWrapper) ID() uint64
ID returns the ID of the source driver
func (*MultisourceWrapper) Info ¶
func (wrp *MultisourceWrapper) Info() *adtype.SourceInfo
Info returns information about the source platform and the source protocol
func (*MultisourceWrapper) ObjectKey ¶
func (wrp *MultisourceWrapper) ObjectKey() uint64
ObjectKey returns the object key of the source driver
func (*MultisourceWrapper) PriceCorrectionReduceFactor ¶
func (wrp *MultisourceWrapper) PriceCorrectionReduceFactor() float64
PriceCorrectionReduceFactor returns the price correction reduce factor If there is a 10% price correction, it means that 10% of the final price must be ignored
func (*MultisourceWrapper) ProcessResponse ¶
func (wrp *MultisourceWrapper) ProcessResponse(response adtype.Response)
ProcessResponse processes the response to update metrics and log information
func (*MultisourceWrapper) ProcessResponseItem ¶
func (wrp *MultisourceWrapper) ProcessResponseItem(response adtype.Response, ad adtype.ResponseItem)
ProcessResponseItem processes an individual response item
func (*MultisourceWrapper) Protocol ¶
func (wrp *MultisourceWrapper) Protocol() string
Protocol returns the protocol of the source driver
func (*MultisourceWrapper) RevenueShareReduceFactor ¶
func (wrp *MultisourceWrapper) RevenueShareReduceFactor() float64
RevenueShareReduceFactor returns the revenue share reduce factor
func (*MultisourceWrapper) ServersCount ¶
func (wrp *MultisourceWrapper) ServersCount() int
ServersCount returns the number of ad servers
func (*MultisourceWrapper) SetRequestTimeout ¶
func (wrp *MultisourceWrapper) SetRequestTimeout(ctx context.Context, timeout time.Duration)
SetRequestTimeout sets the request timeout, ensuring it is not below the minimal timeout
func (*MultisourceWrapper) Sources ¶
func (wrp *MultisourceWrapper) Sources() adtype.SourceAccessor
Sources returns the source accessor
func (*MultisourceWrapper) Test ¶
func (wrp *MultisourceWrapper) Test(request adtype.BidRequester) error
Test validates the request before processing
type Option ¶
type Option func(wrp *MultisourceWrapper)
Option sets some property of the server
func WithMaxParallelRequests ¶
WithMaxParallelRequests returns count of requests to external sources by one request
func WithResponsePreprocessor ¶
func WithResponsePreprocessor(preprocessor ResponsePreprocessor) Option
WithResponsePreprocessor returns a response preprocessor
func WithServersCount ¶
WithServersCount returns the number of ad servers
func WithSourceAccessor ¶
func WithSourceAccessor(sources adtype.SourceAccessor) Option
WithSourceAccessor for the server
type ResponsePreprocessor ¶
type SourceError ¶
SourceError contains only errors from some source drivers
func (*SourceError) Error ¶
func (e *SourceError) Error() string