server

package
v0.0.0-...-f78b0ad Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2020 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IDALL           = "all" // flag to get all stages' detail
	IDList          = "list"
	ConfigSeparator = "---\n" // separator to join configuration
	ListSeparator   = ","     // separator to join stage list
)

API constants

Variables

View Source
var (
	ErrNoCommand        = errors.New("NoCommand")
	ErrNoTarget         = errors.New("NoTarget")
	ErrUnknownTarget    = errors.New("UnknownTarget")
	ErrCreateConnection = errors.New("ConnectFailed")
)

errors for execution of raw command

View Source
var (
	FIValueAgent      = "agent"
	FIValueController = "controller"
	FIRole            = "FI_ROLE"
	FIHTTP            = "FI_HTTP"
	FIGRPC            = "FI_GRPC"
	FIControllerGRPC  = "FI_CONTROLLER_GRPC"
	FINodeRole        = "FI_NODE_ROLE"
	FISelector        = "FI_SELECTOR"

	ConfigPath = "path"
)

configuration

Functions

This section is empty.

Types

type APIReturn

type APIReturn struct {
	Status string                 `json:"status"` // process status
	Data   map[string]interface{} `json:"data"`   // result returned
}

APIReturn is the HTTP return value

type Agent

type Agent struct {
	AddressGRPC       string            // GRPC listen address
	ControllerAddress string            // Controller GRPC address
	Role              string            // node role
	Selector          map[string]string // selector
	SelectorStr       string            // selector string
	Version           string            // version
	NemesisManager    *nemesis.Manager  // nemesis manager
}

Agent deployed with the nodes of cluster

func NewAgent

func NewAgent(config map[string]string) *Agent

NewAgent create a Agent

func (*Agent) Exec

func (a *Agent) Exec(ctx context.Context, req *pb.ExecRequest) (*pb.ExecResponse, error)

Exec run a command at the agent

func (*Agent) Nemesis

func (a *Agent) Nemesis(ctx context.Context, req *pb.NemesisRequest) (*pb.NemesisResponse, error)

Nemesis manage a nemesis at the agent

func (*Agent) Register

func (a *Agent) Register() error

Register report node info to controller

func (*Agent) Run

func (a *Agent) Run() error

Run serve as a agent

type Controller

type Controller struct {
	AddressGRPC string
	AddressHTTP string
	ConfigPath  string
	TaskManager *control.TaskManager
	Config      *config.ControllerConfig
}

Controller is a impliment of GRPC

func NewController

func NewController(config map[string]string) *Controller

NewController create a new Controller

func (*Controller) Register

Register is a impliment of pb.Controller

func (*Controller) Run

func (c *Controller) Run() error

Run serve as a controller

type Server

type Server interface {
	Run() error
}

Server intreface

func NewServer

func NewServer(config map[string]string) Server

NewServer create a new server by role

Jump to

Keyboard shortcuts

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