resource

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cache = make(map[string]App)
View Source
var EnginerNewerFuncs = make(map[string]EngineNewerFunc)
View Source
var ExecutorChan = make(chan utils.Event)
View Source
var ExecutorNewerFuncs = make(map[string]ExecutorNewerFunc)
View Source
var MonitorChan = make(chan utils.Event)
View Source
var MonitorDataChan = make(chan utils.Event)
View Source
var MonitorNewerFuncs = make(map[string]MonitorNewerFunc)
View Source
var PolicyNewerFuncs = make(map[string]PolicyNewerFunc)
View Source
var RegisterChan = make(chan utils.Event)
View Source
var WatcherChan = make(chan utils.Event)
View Source
var WatcherNewerFuncs = make(map[string]WatcherNewerFunc)

Functions

func RegisterEngine

func RegisterEngine(name string, constructor EngineNewerFunc)

func RegisterExecutor

func RegisterExecutor(name string, constructor ExecutorNewerFunc)

func RegisterMonitor

func RegisterMonitor(name string, constructor MonitorNewerFunc)

func RegisterPolicy

func RegisterPolicy(name string, constructor PolicyNewerFunc)

func RegisterWatcher

func RegisterWatcher(name string, constructor WatcherNewerFunc)

Types

type App

type App struct {
	PolicyId string
	ClosId   string
	Resctrl  Resctrl
	Status   int
	Error    error
}

type EngineNewerFunc

type EngineNewerFunc func() (ResourceEngine, error)

type ExampleEngine added in v0.3.0

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

func (*ExampleEngine) AddMonitorReceiver added in v0.3.0

func (e *ExampleEngine) AddMonitorReceiver(policy_id string, receiver MonitorReceiver)

func (*ExampleEngine) GetApp added in v0.3.0

func (e *ExampleEngine) GetApp(id string) (App, error)

func (*ExampleEngine) GetConfig added in v0.3.0

func (e *ExampleEngine) GetConfig() string

func (*ExampleEngine) RegisterApp added in v0.3.0

func (e *ExampleEngine) RegisterApp(id string, policy_id string, podMeta string) error

func (*ExampleEngine) SetConfig added in v0.3.0

func (e *ExampleEngine) SetConfig(configJSON string) error

func (*ExampleEngine) Start added in v0.3.0

func (e *ExampleEngine) Start()

func (*ExampleEngine) UnRegisterApp added in v0.3.0

func (e *ExampleEngine) UnRegisterApp(id string) error

type ExampleMonitor added in v0.3.0

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

func (*ExampleMonitor) GetConfig added in v0.3.0

func (m *ExampleMonitor) GetConfig() string

func (*ExampleMonitor) GetName added in v0.3.0

func (m *ExampleMonitor) GetName() string

func (*ExampleMonitor) OnMonitor added in v0.3.0

func (m *ExampleMonitor) OnMonitor(e utils.Event)

func (*ExampleMonitor) SetConfig added in v0.3.0

func (m *ExampleMonitor) SetConfig(s string) error

func (*ExampleMonitor) Start added in v0.3.0

func (m *ExampleMonitor) Start()

type ExampleMonitorReceiver added in v0.3.0

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

func (*ExampleMonitorReceiver) GetMonitorName added in v0.3.0

func (receiver *ExampleMonitorReceiver) GetMonitorName() string

func (*ExampleMonitorReceiver) GetPolicyName added in v0.3.0

func (receiver *ExampleMonitorReceiver) GetPolicyName() string

func (*ExampleMonitorReceiver) OnMonitorData added in v0.3.0

func (receiver *ExampleMonitorReceiver) OnMonitorData(event utils.Event)

type ExamplePodWatcher added in v0.3.0

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

func (*ExamplePodWatcher) GetConfig added in v0.3.0

func (w *ExamplePodWatcher) GetConfig() string

func (*ExamplePodWatcher) GetName added in v0.3.0

func (w *ExamplePodWatcher) GetName() string

func (*ExamplePodWatcher) OnWatch added in v0.3.0

func (w *ExamplePodWatcher) OnWatch(e utils.Event)

func (*ExamplePodWatcher) SetConfig added in v0.3.0

func (w *ExamplePodWatcher) SetConfig(s string) error

func (*ExamplePodWatcher) Start added in v0.3.0

func (w *ExamplePodWatcher) Start()

type ExamplePolicy added in v0.3.0

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

func (*ExamplePolicy) AddMonitorReceivers added in v0.3.0

func (p *ExamplePolicy) AddMonitorReceivers(receiver MonitorReceiver) error

func (*ExamplePolicy) GetConfig added in v0.3.0

func (p *ExamplePolicy) GetConfig() string

func (*ExamplePolicy) GetExecutors added in v0.3.0

func (p *ExamplePolicy) GetExecutors() map[string]Executor

func (*ExamplePolicy) GetMonitorReceivers added in v0.3.0

func (p *ExamplePolicy) GetMonitorReceivers() []MonitorReceiver

func (*ExamplePolicy) GetMonitors added in v0.3.0

func (p *ExamplePolicy) GetMonitors() map[string]Monitor

func (*ExamplePolicy) GetName added in v0.3.0

func (p *ExamplePolicy) GetName() string

func (*ExamplePolicy) GetWatchers added in v0.3.0

func (p *ExamplePolicy) GetWatchers() map[string]Watcher

func (*ExamplePolicy) OnMonitorData added in v0.3.1

func (p *ExamplePolicy) OnMonitorData(e utils.Event)

func (*ExamplePolicy) OnRegister added in v0.3.0

func (p *ExamplePolicy) OnRegister(e utils.Event)

func (*ExamplePolicy) SetConfig added in v0.3.0

func (p *ExamplePolicy) SetConfig(s string) error

func (*ExamplePolicy) Start added in v0.3.0

func (p *ExamplePolicy) Start()

type Executor

type Executor interface {
	GetName() string
	SetConfig(string) error // Set new configuration.
	GetConfig() string      // Get current configuration.
	OnExecutor(event utils.Event)
	Start()
}

func NewExecutor

func NewExecutor(name string) (Executor, error)

NewPolicy creates a new instance of a policy based on its name.

func RDTExecutorNewer

func RDTExecutorNewer() (Executor, error)

type ExecutorConfig

type ExecutorConfig struct {
	Name   string
	Config string
}

type ExecutorNewerFunc

type ExecutorNewerFunc func() (Executor, error)

type FixedClassMonitorConfig

type FixedClassMonitorConfig struct {
}

type FixedClassPolicyConfig

type FixedClassPolicyConfig struct {
	ConfigPath string           `yaml:"configPath"`
	Watchers   []WatcherConfig  `yaml:"watchers"`
	Monitors   []MonitorConfig  `yaml:"monitors"`
	Executors  []ExecutorConfig `yaml:"executors"`
}

type Monitor

type Monitor interface {
	GetName() string
	SetConfig(config string) error
	GetConfig() string
	OnMonitor(e utils.Event)
	Start()
}

func FixedClassMonitorNewer

func FixedClassMonitorNewer() (Monitor, error)

func NewMonitor

func NewMonitor(name string) (Monitor, error)

NewPolicy creates a new instance of a policy based on its name.

type MonitorConfig

type MonitorConfig struct {
	Name   string
	Config string
}

type MonitorNewerFunc

type MonitorNewerFunc func() (Monitor, error)

type MonitorReceiver

type MonitorReceiver interface {
	OnMonitorData(event utils.Event)
	GetPolicyName() string
	GetMonitorName() string
}

func NewRDTMonitorReceiver

func NewRDTMonitorReceiver(policy_id, monitor_id string) MonitorReceiver

type PodWatcherConfig

type PodWatcherConfig struct {
	Pods []string `json:"pods"`
}

type Policy

type Policy interface {
	GetName() string
	OnRegister(e utils.Event)
	OnMonitorData(e utils.Event)
	SetConfig(string) error // Set new configuration.
	GetConfig() string      // Get current configuration.
	GetMonitors() map[string]Monitor
	GetWatchers() map[string]Watcher
	GetExecutors() map[string]Executor
	GetMonitorReceivers() []MonitorReceiver
	AddMonitorReceivers(receiver MonitorReceiver) error
	Start()
}

func FixedClassPolicyNewer

func FixedClassPolicyNewer() (Policy, error)

func NewPolicy

func NewPolicy(name string) (Policy, error)

NewPolicy creates a new instance of a policy based on its name.

type PolicyConfig

type PolicyConfig struct {
	Name   string
	Config string
}

type PolicyNewerFunc

type PolicyNewerFunc func() (Policy, error)

type RDTEngineConfig

type RDTEngineConfig struct {
	Name   string
	Config string
	Policy []PolicyConfig
}

type RDTExecutor

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

func (*RDTExecutor) GetConfig

func (e *RDTExecutor) GetConfig() string

func (*RDTExecutor) GetName

func (e *RDTExecutor) GetName() string

func (*RDTExecutor) OnExecutor

func (e *RDTExecutor) OnExecutor(event utils.Event)

func (*RDTExecutor) SetConfig

func (e *RDTExecutor) SetConfig(s string) error

func (*RDTExecutor) Start

func (e *RDTExecutor) Start()

type RDTExecutorConfig

type RDTExecutorConfig struct {
}

type Resctrl

type Resctrl struct {
	L3    map[int]int64
	MB    map[int]int64
	L3Num int
}

type ResourceEngine

type ResourceEngine interface {
	RegisterApp(id string, policy_id string, podMeta string) error
	UnRegisterApp(id string) error
	GetApp(id string) (App, error)
	SetConfig(config string) error
	GetConfig() string
	Start()
	AddMonitorReceiver(policy_id string, receiver MonitorReceiver)
}

func NewEngine

func NewEngine(name string) (ResourceEngine, error)

func RDTEngineNewer

func RDTEngineNewer() (ResourceEngine, error)

type ResourceEngineConfig

type ResourceEngineConfig struct {
	Name   string
	Config string
}

type SampleEventData

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

func (*SampleEventData) GetEventType

func (s *SampleEventData) GetEventType() utils.EventType

type Watcher

type Watcher interface {
	GetName() string
	SetConfig(config string) error
	GetConfig() string
	OnWatch(e utils.Event)
	Start()
}

func NewWatcher

func NewWatcher(name string) (Watcher, error)

NewPolicy creates a new instance of a policy based on its name.

func PodWatcherNewer

func PodWatcherNewer() (Watcher, error)

type WatcherConfig

type WatcherConfig struct {
	Name   string
	Config string
}

type WatcherNewerFunc

type WatcherNewerFunc func() (Watcher, error)

Jump to

Keyboard shortcuts

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