CostModel configures overload cost estimators and cost trackers from a set of cost.OverloadModel definitions. Models are validated here because neither the estimator nor the tracker compiled from a model can report a problem once evaluation has begun. See cost.OverloadModel.Validate.
(models ...cost.OverloadModel)
| 880 | // Models are validated here because neither the estimator nor the tracker compiled from a model |
| 881 | // can report a problem once evaluation has begun. See cost.OverloadModel.Validate. |
| 882 | func CostModel(models ...cost.OverloadModel) EnvOption { |
| 883 | return func(e *Env) (*Env, error) { |
| 884 | if err := cost.ValidateOverloadModels(models...); err != nil { |
| 885 | return nil, err |
| 886 | } |
| 887 | e.costConfig.models = append(e.costConfig.models, models...) |
| 888 | return e, nil |
| 889 | } |
| 890 | } |
| 891 | |
| 892 | // CostSizingStrategy configures a SizingStrategy for both cost estimation and runtime cost tracking. |
| 893 | func CostSizingStrategy(strategy cost.SizingStrategy) EnvOption { |