bidengine

package
v0.12.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2026 License: Apache-2.0 Imports: 49 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultPricePrecision = 6
)

Variables

View Source
var (
	ErrBidQuantityInvalid = errors.New("a bid quantity is invalid")
	ErrBidZero            = errors.New("a bid of zero was produced")
)
View Source
var ErrNotRunning = errors.New("not running")

ErrNotRunning declares new error with message "not running"

Functions

func CheckBidEligibility

func CheckBidEligibility(
	gspec *dtypes.GroupSpec,
	providerAttrs atrtypes.Attributes,
	bidAttrs atrtypes.Attributes,
	maxGroupVolumes int,
	pass ProviderAttrSignatureService,
	providerOwner string,
) (bool, []string, error)

CheckBidEligibility checks whether a provider should bid on a given group spec. Returns (shouldBid, reasons, error) where reasons lists why bidding was declined. This is used by both the live bid flow and the bid screening/precheck endpoint.

Types

type BidPricingStrategy

type BidPricingStrategy interface {
	CalculatePrice(ctx context.Context, req Request) (sdk.DecCoin, error)
}

func MakeRandomRangePricing

func MakeRandomRangePricing() (BidPricingStrategy, error)

func MakeScalePricing

func MakeScalePricing(
	cpuScale decimal.Decimal,
	memoryScale decimal.Decimal,
	storageScale Storage,
	endpointScale decimal.Decimal,
	ipScale decimal.Decimal,
) (BidPricingStrategy, error)

func MakeShellScriptPricing

func MakeShellScriptPricing(path string, processLimit uint, runtimeLimit time.Duration) (BidPricingStrategy, error)

type Config

type Config struct {
	PricingStrategy BidPricingStrategy
	Deposit         sdk.Coin
	BidTimeout      time.Duration
	Attributes      atttypes.Attributes
	MaxGroupVolumes int
}

Config represents the configuration parameters for the bid engine. It controls pricing, deposits, timeouts and provider capabilities and attributes

type ProviderAttrSignatureService

type ProviderAttrSignatureService interface {
	GetAuditorAttributeSignatures(auditor string) (atypes.AuditedProviders, error)
	GetAttributes() (atrtypes.Attributes, error)
}

type Request

type Request struct {
	Owner              string `json:"owner"`
	GSpec              *dtypes.GroupSpec
	AllocatedResources dtypes.ResourceUnits
	PricePrecision     int
}

type ScreenBidResult

type ScreenBidResult struct {
	Passed             bool
	Reasons            []string
	AllocatedResources dtypes.ResourceUnits
	ClusterParams      interface{}
	Price              sdk.DecCoin
}

ScreenBidResult contains the result of a bid screening/precheck operation.

type Service

type Service interface {
	StatusClient
	ScreenBid(ctx context.Context, gspec *dtypes.GroupSpec) (*ScreenBidResult, error)
	Close() error
	Done() <-chan struct{}
}

Service handles bidding on orders.

func NewService

func NewService(
	pctx context.Context,
	aqc sclient.QueryClient,
	session session.Session,
	cluster cluster.Cluster,
	bus pubsub.Bus,
	waiter waiter.OperatorWaiter,
	cfg Config,
) (Service, error)

NewService creates new service instance and returns error in case of failure

type StatusClient

type StatusClient interface {
	Status(context.Context) (*apclient.BidEngineStatus, error)
	StatusV1(ctx context.Context) (*provider.BidEngineStatus, error)
}

StatusClient interface predefined with Status method

type Storage

type Storage map[string]decimal.Decimal

func (Storage) AllLessThenOrEqual

func (ss Storage) AllLessThenOrEqual(val decimal.Decimal) bool

AllLessThenOrEqual check all storage classes fit into max limits note better have dedicated limits for each class

func (Storage) IsAnyNegative

func (ss Storage) IsAnyNegative() bool

func (Storage) IsAnyZero

func (ss Storage) IsAnyZero() bool

Jump to

Keyboard shortcuts

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