interfaces

package
v2.4.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// we define all communication error into one bucket
	// TODO: separate out the different comm issues (e.g. DNS vs Connection refused etc.)
	V2CommunicationErrCode = -100
	// i.e invalid method etc.
	V2RequestErrCode = -200
)

Variables

View Source
var ErrControlPlaneBadRequest = errors.New("ControlPlane Bad Request")
View Source
var ErrServerNotReady = errors.New("Server not ready")

Functions

This section is empty.

Types

type CacheManager

type CacheManager interface {
	// add a new node with specific id and priority/value
	Add(string, int64) error
	// add a new node with specific id and default priority/value
	AddDefault(string) error
	// update value for given id, which would reflect in order
	Update(id string, value int64) error
	// default bump value for given id, which would reflect in order
	UpdateDefault(string) error
	// check if value exists
	Exists(string) bool
	// get value/priority of given id
	Get(string) (int64, error)
	// delete item with id from cache
	Delete(id string) error
	// get a list of all keys / values
	GetItems() ([]string, []int64)
	// peek top of queue (no evict)
	Peek() (string, int64, error)
	// evict
	Evict() (string, int64, error)
}

type ControlPlaneErr added in v2.4.0

type ControlPlaneErr struct {
	IsGrpc bool
	Err    error
	// one bucket for http/grpc status code and client codes (for error)
	ErrCode int
}

Error wrapper with client and server errors + error code errCode should have the standard http error codes (for server) and client communication error codes (defined above)

func (*ControlPlaneErr) Error added in v2.4.0

func (err *ControlPlaneErr) Error() string

func (*ControlPlaneErr) IsNotFound added in v2.4.0

func (v *ControlPlaneErr) IsNotFound() bool

type DependencyServiceInterface

type DependencyServiceInterface interface {
	SetState(state interface{})
	Start() error
	Ready() bool
	Stop() error
	Name() string
}

type LogicOperation

type LogicOperation int
const (
	Gte LogicOperation = iota
)

type ModelScalingStats

type ModelScalingStats interface {
	Inc(string, uint32) error
	IncDefault(string) error
	Dec(string, uint32) error
	DecDefault(string) error
	Reset(string) error
	Set(string, uint32) error
	Get(string) (uint32, error)
	GetAll(uint32, LogicOperation, bool) ([]*ModelStatsKV, error)
	Info() string
	Delete(string) error
	Add(string) error
}

type ModelServerConfig added in v2.4.0

type ModelServerConfig struct {
	Host   string
	Port   int
	Logger log.FieldLogger
}

type ModelServerControlPlaneClient added in v2.4.0

type ModelServerControlPlaneClient interface {
	LoadModel(name string) *ControlPlaneErr
	UnloadModel(name string) *ControlPlaneErr
	Live() error
	GetModels() ([]ServerModelInfo, error)
}

type ModelStatsKV

type ModelStatsKV struct {
	Value     uint32
	Key       string
	ModelName string
}

type ServerModelInfo added in v2.4.0

type ServerModelInfo struct {
	Name  string
	State ServerModelState
}

type ServerModelState added in v2.4.0

type ServerModelState string
const (
	ServerModelState_UNKNOWN     ServerModelState = "UNKNOWN"
	ServerModelState_READY       ServerModelState = "READY"
	ServerModelState_UNAVAILABLE ServerModelState = "UNAVAILABLE"
	ServerModelState_LOADING     ServerModelState = "LOADING"
	ServerModelState_UNLOADING   ServerModelState = "UNLOADING"
)

type V2ServerError added in v2.4.0

type V2ServerError struct {
	Error string `json:"error"`
}

Jump to

Keyboard shortcuts

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