controller

package
v0.0.0-...-bb2f907 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2023 License: Apache-2.0 Imports: 21 Imported by: 25

Documentation

Index

Constants

View Source
const (
	MinControllerPriority            = 1
	MaxControllerPriority            = 1000000
	CONTROLLER_TYPE_ACTION    string = "action"
	CONTROLLER_TYPE_PLACEMENT string = "placement"
)

Variables

Functions

This section is empty.

Types

type Controller

type Controller struct {
	Metadata mtypes.Metadata `json:"metadata"`
	Spec     ControllerSpec  `json:"spec"`
}

Controller contains the parameters needed for Controllers It implements the interface for managing the Controllers

type ControllerClient

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

ControllerClient implements the Manager It will also be used to maintain some localized state

func NewControllerClient

func NewControllerClient(name, tag, group string) *ControllerClient

NewControllerClient returns an instance of the ControllerClient which implements the Manager

func (*ControllerClient) CreateController

func (mc *ControllerClient) CreateController(ctx context.Context, m Controller, mayExist bool) (Controller, error)

CreateController a new collection based on the Controller

func (*ControllerClient) DeleteController

func (mc *ControllerClient) DeleteController(ctx context.Context, name string) error

DeleteController the Controller from database

func (*ControllerClient) GetController

func (mc *ControllerClient) GetController(ctx context.Context, name string) (Controller, error)

GetController returns the Controller for corresponding name

func (*ControllerClient) GetControllers

func (mc *ControllerClient) GetControllers(ctx context.Context) ([]Controller, error)

GetControllers returns all the Controllers that are registered

func (*ControllerClient) InitControllers

func (mc *ControllerClient) InitControllers(ctx context.Context)

InitControllers initializes connctions for controllers in the DB

type ControllerKey

type ControllerKey struct {
	ControllerName  string `json:"controller"`
	ControllerGroup string `json:"controllerGroup"`
}

ControllerKey is the key structure that is used in the database

func (ControllerKey) String

func (mk ControllerKey) String() string

We will use json marshalling to convert to string to preserve the underlying structure.

type ControllerManager

type ControllerManager interface {
	CreateController(ctx context.Context, ms Controller, mayExist bool) (Controller, error)
	GetController(ctx context.Context, name string) (Controller, error)
	GetControllers(ctx context.Context) ([]Controller, error)
	InitControllers(ctx context.Context)
	DeleteController(ctx context.Context, name string) error
}

ControllerManager is an interface exposes the Controller functionality

type ControllerServer

type ControllerServer struct {
	ListenAndServe func() error
	Shutdown       func(context.Context) error
}

ControllerServer implements a controller/manager service

func NewControllerServer

func NewControllerServer(name string, httpRouter *mux.Router, grpcServer *register.GrpcServer) (*ControllerServer, error)

type ControllerSpec

type ControllerSpec struct {
	Host     string `json:"host"`
	Port     int    `json:"port"`
	Type     string `json:"type"`
	Priority int    `json:"priority"`
}

Jump to

Keyboard shortcuts

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