Documentation ¶
Index ¶
Constants ¶
View Source
const (
ScorerNameDefault = "default"
)
Variables ¶
View Source
var ( ErrUnknownAlgorithm = errors.New("unknown rating algorithm") ErrAlgorithmParams = errors.New("invalid algorithm params") )
View Source
var ErrInvalidWeights = errors.New("weights must sum to 1")
Functions ¶
This section is empty.
Types ¶
type Rating ¶
type Rating struct {
// contains filtered or unexported fields
}
Filters bids based on the config, uses the scorer to rate the bids and sorts them
func NewRatingFromConfig ¶
type RatingConfig ¶
type RatingConfig struct { Algorithm string `json:"algorithm"` Params json.RawMessage `json:"params"` ProviderAllowList []common.Address `json:"providerAllowlist"` }
type RatingInput ¶
type ScoreInput ¶
type ScoreInput struct { ProviderModel *s.IStatsStorageProviderModelStats // stats of the provider specific to the model Model *s.IStatsStorageModelStats // stats of the model across providers PricePerSecond *big.Int ProviderStake *big.Int MinStake *big.Int }
ScoreInput is a struct that holds the input data for the rating algorithm of a bid
func NewScoreArgs ¶
func NewScoreArgs() *ScoreInput
type Scorer ¶
type Scorer interface { // GetScore returns the score of a bid. Returns -Inf if the bid should be skipped GetScore(args *ScoreInput) float64 }
type ScorerDefault ¶
type ScorerDefault struct {
// contains filtered or unexported fields
}
func NewScorerDefault ¶
func NewScorerDefault(weights ScorerDefaultParams) *ScorerDefault
func NewScorerDefaultFromJSON ¶
func NewScorerDefaultFromJSON(data json.RawMessage) (*ScorerDefault, error)
func (*ScorerDefault) GetScore ¶
func (r *ScorerDefault) GetScore(args *ScoreInput) float64
type ScorerDefaultParams ¶
type ScorerDefaultParams struct { Weights struct { TPS float64 `json:"tps"` TTFT float64 `json:"ttft"` Duration float64 `json:"duration"` Success float64 `json:"success"` Stake float64 `json:"stake"` } `json:"weights"` }
func ScorerDefaultParamsMock ¶
func ScorerDefaultParamsMock() ScorerDefaultParams
func (*ScorerDefaultParams) Validate ¶
func (w *ScorerDefaultParams) Validate() bool
type ScorerMock ¶
type ScorerMock struct { }
func NewScorerMock ¶
func NewScorerMock() *ScorerMock
func (*ScorerMock) GetScore ¶
func (m *ScorerMock) GetScore(args *ScoreInput) float64
Click to show internal directories.
Click to hide internal directories.