placement

package
v0.2.0-alpha Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrPlacementFailed = errors.New("placement failed")

Functions

This section is empty.

Types

type AnswerFunc

type AnswerFunc func(*PlacementResponse) error

type Broker

type Broker struct {
	// contains filtered or unexported fields
}

func NewBroker

func NewBroker(nc *nats.Conn) *Broker

func (*Broker) GetAvailableWorkers

func (b *Broker) GetAvailableWorkers(req PlacementRequest) ([]PlacementResponse, error)

type Listener

type Listener struct {
	// contains filtered or unexported fields
}

func NewListener

func NewListener(nats *nats.Conn) *Listener

func (*Listener) HandleMachinePlacementRequest

func (l *Listener) HandleMachinePlacementRequest(ctx context.Context, region string, handler func(msg *PlacementRequest) *PlacementResponse) error

func (Listener) Stop

func (l Listener) Stop()

type PlacementRequest

type PlacementRequest struct {
	AllocationId string        `json:"allocation_id"`
	Region       string        `json:"region"`
	Resources    api.Resources `json:"resources"`
}

type PlacementResponse

type PlacementResponse struct {
	NodeId          string        `json:"node_id"`
	Allocatable     api.Resources `json:"allocatable"`
	AllocatedBefore api.Resources `json:"allocated_before"`
	AllocatedAfter  api.Resources `json:"allocated_after"`
}

func (PlacementResponse) GetScore

func (r PlacementResponse) GetScore() float64

Jump to

Keyboard shortcuts

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