resource

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2023 License: Apache-2.0 Imports: 12 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ResourceAdvisor

type ResourceAdvisor interface {
	// Run starts all sub resource advisors
	Run(ctx context.Context)

	// GetSubAdvisor returns the corresponding sub advisor according to resource name
	GetSubAdvisor(resourceName types.QoSResourceName) (SubResourceAdvisor, error)

	// GetHeadroom returns the corresponding headroom quantity according to resource name
	GetHeadroom(resourceName v1.ResourceName) (resource.Quantity, error)
}

ResourceAdvisor is a wrapper of different sub resource advisors. It can be registered to headroom reporter to give designated resource headroom quantity based on provision result.

func NewResourceAdvisor

func NewResourceAdvisor(conf *config.Configuration, extraConf interface{}, metaCache metacache.MetaCache,
	metaServer *metaserver.MetaServer, emitter metrics.MetricEmitter) (ResourceAdvisor, error)

NewResourceAdvisor returns a resource advisor wrapper instance, initializing all required sub resource advisor according to config

type ResourceAdvisorStub

type ResourceAdvisorStub struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewResourceAdvisorStub

func NewResourceAdvisorStub() *ResourceAdvisorStub

func (*ResourceAdvisorStub) GetHeadroom

func (r *ResourceAdvisorStub) GetHeadroom(resourceName v1.ResourceName) (resource.Quantity, error)

func (*ResourceAdvisorStub) GetSubAdvisor

func (r *ResourceAdvisorStub) GetSubAdvisor(resourceName types.QoSResourceName) (SubResourceAdvisor, error)

func (*ResourceAdvisorStub) Run added in v0.2.0

func (r *ResourceAdvisorStub) Run(ctx context.Context)

func (*ResourceAdvisorStub) SetHeadroom

func (r *ResourceAdvisorStub) SetHeadroom(resourceName v1.ResourceName, quantity resource.Quantity)

type SubResourceAdvisor

type SubResourceAdvisor interface {
	// Run starts resource provision update based on the latest system and workload snapshot(s)
	Run(ctx context.Context)

	// GetChannels returns two channels. The first one receives update trigger from qrm server.
	// The other one sends the latest internal calculation result to qrm server.
	GetChannels() (interface{}, interface{})

	// GetHeadroom returns the latest resource headroom quantity for resource reporter
	GetHeadroom() (resource.Quantity, error)
}

SubResourceAdvisor updates resource provision of a certain dimension based on the latest system and workload snapshot(s), and returns provision advice or resource headroom quantity. It should push updated results to the corresponding qrm server.

func NewSubResourceAdvisor

func NewSubResourceAdvisor(resourceName types.QoSResourceName, conf *config.Configuration, extraConf interface{},
	metaCache metacache.MetaCache, metaServer *metaserver.MetaServer, emitter metrics.MetricEmitter) (SubResourceAdvisor, error)

NewSubResourceAdvisor returns a corresponding advisor according to resource name

type SubResourceAdvisorStub

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

func NewSubResourceAdvisorStub

func NewSubResourceAdvisorStub() *SubResourceAdvisorStub

func (*SubResourceAdvisorStub) GetChannels added in v0.2.0

func (s *SubResourceAdvisorStub) GetChannels() (interface{}, interface{})

func (*SubResourceAdvisorStub) GetHeadroom

func (s *SubResourceAdvisorStub) GetHeadroom() (resource.Quantity, error)

func (*SubResourceAdvisorStub) Name

func (s *SubResourceAdvisorStub) Name() string

func (*SubResourceAdvisorStub) Run added in v0.2.0

func (*SubResourceAdvisorStub) SetHeadroom

func (s *SubResourceAdvisorStub) SetHeadroom(quantity resource.Quantity)

Jump to

Keyboard shortcuts

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