bidengine

package
v0.6.5-rc0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2024 License: Apache-2.0 Imports: 44 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

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      types.Attributes
	MaxGroupVolumes int
}

type ProviderAttrSignatureService

type ProviderAttrSignatureService interface {
	GetAuditorAttributeSignatures(auditor string) ([]atypes.Provider, error)
	GetAttributes() (types.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(ctx context.Context, 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 Status

type Status struct {
	Orders uint32 `json:"orders"`
}

Status stores orders

type StatusClient

type StatusClient interface {
	Status(context.Context) (*Status, 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