bidengine

package
v0.1.0-beta.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// DefaultRescanInterval is the default interval between order rescans
	DefaultRescanInterval = 30 * time.Second
	// RescanPageSize is the number of orders to fetch per page during rescan
	RescanPageSize = 100
)
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

This section is empty.

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
	// Rescan configures the periodic order rescan loop; nil means
	// DefaultOrderRescanConfig()
	Rescan *OrderRescanConfig
}

type OrderRescanConfig

type OrderRescanConfig struct {
	// Enabled controls whether periodic rescan is active
	Enabled bool `json:"enabled" yaml:"enabled"`
	// Interval between rescans
	Interval time.Duration `json:"interval" yaml:"interval"`
	// PageSize for pagination when querying orders
	PageSize int `json:"page_size" yaml:"page_size"`
}

OrderRescanConfig configures the order rescan behavior

func DefaultOrderRescanConfig

func DefaultOrderRescanConfig() OrderRescanConfig

DefaultOrderRescanConfig returns default rescan configuration

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 Service

type Service interface {
	StatusClient
	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