api

package
v1.15.12 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RLServerAddressKey = "RL_SERVER_ADDRESS"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	// Returns latest metrics present in load Watcher cache
	GetLatestWatcherMetrics() (*metricstype.WatcherMetrics, error)
	// for statistics based load variation balancing plugin, reduce some redunant data
	GetCompactWatcherMetrics() (*metricstype.WatcherMetrics, error)
	Healthy() error
}

Watcher Client API

func NewLibraryClient

func NewLibraryClient(opts metricsprovider.MetricsProviderOpts) (Client, error)

Creates a new watcher client when using watcher as a library

func NewServiceClient

func NewServiceClient(watcherAddress string) (Client, error)

Creates a new watcher client when using watcher as a service

type PredictResponceResult

type PredictResponceResult struct {
	PodName string `json:"pod"`
	Node    string `json:"node"`
}

func (*PredictResponceResult) NKeys

func (rl *PredictResponceResult) NKeys() int

func (*PredictResponceResult) UnmarshalJSONObject

func (rl *PredictResponceResult) UnmarshalJSONObject(dec *gojay.Decoder, key string) error

type RLClient

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

func NewRLClient

func NewRLClient(address string) (RLClient, error)

func (RLClient) Healthy

func (c RLClient) Healthy() error

func (RLClient) Predict

func (RLClient) Update

func (c RLClient) Update(request RLClientUpdateRequest) error

type RLClientPredictRequest

type RLClientPredictRequest struct {
	PodName  string   `json:"pod_name"`
	PodLabel string   `json:"pod_label"`
	Nodes    []string `json:"nodes"`
}

func MakePredictRequest

func MakePredictRequest(podName, podLabel string, nodes []string) (RLClientPredictRequest, error)

type RLClientPredictResponce

type RLClientPredictResponce struct {
	State   string                `json:"state"`
	Message string                `json:"message"`
	Result  PredictResponceResult `json:"result"`
}

func (*RLClientPredictResponce) NKeys

func (rl *RLClientPredictResponce) NKeys() int

func (*RLClientPredictResponce) UnmarshalJSONObject

func (rl *RLClientPredictResponce) UnmarshalJSONObject(dec *gojay.Decoder, key string) error

type RLClientUpdateRequest

type RLClientUpdateRequest struct {
	Timestamp int64                      `json:"tiemstamp"`
	PodName   string                     `json:"pod_name"`
	Metrics   metricstype.WatcherMetrics `json:"metrics"`
}

func MakeUpdateReuqest

func MakeUpdateReuqest(podName string, metrics metricstype.WatcherMetrics) (RLClientUpdateRequest, error)

Jump to

Keyboard shortcuts

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