binpacking

package
v0.0.0-...-c0686e8 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DeFrag is the name for the de-fragmentation policy
	DeFrag = "DEFRAG"

	// FirstFit is the name of the First Fit policy
	FirstFit = "FIRST_FIT"

	// LoadAware is the name of the Load Aware policy
	LoadAware = "LOAD_AWARE"
)

Variables

This section is empty.

Functions

func AddHostToIndex

func AddHostToIndex(id int, offerIndex map[string]summary.HostSummary, processor watchevent.WatchProcessor)

func CleanUpRanker

func CleanUpRanker()

CleanUpRanker is for testing purpose only.

func CreateOffer

func CreateOffer(
	hostName string,
	resource scalar.Resources) *mesos.Offer

func CreateOfferIndex

func CreateOfferIndex(processor watchevent.WatchProcessor) map[string]summary.HostSummary

func Init

func Init(
	cqosClient cqos.QoSAdvisorServiceYARPCClient,
	metrics *metrics.Metrics)

Init registers all the rankers

Types

type Ranker

type Ranker interface {
	// Returns the name of the ranker implementation
	Name() string
	// returns the list of ranked ordered list
	GetRankedHostList(
		ctx context.Context,
		offerIndex map[string]summary.HostSummary,
	) []interface{}
	// Refreshes the ranker based on new host summary index
	// we need to call this asynchronously to mitigate the
	// performance penalty of bin packing.
	RefreshRanking(
		ctx context.Context,
		offerIndex map[string]summary.HostSummary,
	)
}

Ranker is the interface for ranking strategy for ranking the host it returns the list of ordered list of hosts summary. Caller of the interface would get the list of ordered host summary and then match the host from 0->n to match the constraints with offer.

func GetRankerByName

func GetRankerByName(name string) Ranker

GetRankerByName returns a ranker with specified name

func GetRankers

func GetRankers() []Ranker

GetRankers returns all registered rankers

func NewDeFragRanker

func NewDeFragRanker() Ranker

NewDeFragRanker returns the Defrag Ranker

func NewFirstFitRanker

func NewFirstFitRanker() Ranker

NewFirstFitRanker returns the first fit ranker object

func NewLoadAwareRanker

func NewLoadAwareRanker(
	cqosClient cqos.QoSAdvisorServiceYARPCClient,
	cqosMetrics *metrics.Metrics) Ranker

NewLoadAwareRanker returns the LoadAware Ranker

Jump to

Keyboard shortcuts

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