server

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2022 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SlaveCount

func SlaveCount() int

Types

type AgentStatusResp

type AgentStatusResp struct {
	ConnID string `json:"id"`
	Addr   string `json:"addr"`
	Status string `json:"status"`
}

type ClusterInfo added in v0.1.1

type ClusterInfo struct {
	Data  []AgentStatusResp `json:"data"`
	Error string            `json:"error"`
}

type MasterServer

type MasterServer struct {
	ServerBase
	// contains filtered or unexported fields
}

func (*MasterServer) DoExecuteTask

func (m *MasterServer) DoExecuteTask(address string, request *pb.ExecuteTaskRequest) (*pb.ExecuteTaskResponse, error)

func (*MasterServer) ExecuteTask

func (*MasterServer) HeartBeat

func (m *MasterServer) HeartBeat(stream pb.SqueezeService_HeartBeatServer) error

func (*MasterServer) Initialize

func (m *MasterServer) Initialize(args *ServerArgs) error

func (*MasterServer) Start

func (m *MasterServer) Start(stopChan <-chan struct{}) error

type NodeType

type NodeType int

NodeType indicates the kind of the server.

const (
	// Client represents the client mode
	Client NodeType = iota
	// Slave represents the slave mode
	Slave
	// Master represents the master mode
	Master
	// Web represents the web server mode (As the backend server of the UI)
	Web
)

func (NodeType) String

func (t NodeType) String() string

type Proxy

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

func NewProxy

func NewProxy(target string) (*Proxy, error)

type Server

type Server interface {
	Initialize(args *ServerArgs) error
	Start(stopChan <-chan struct{}) error
}

func NewServer

func NewServer(nodeType NodeType) Server

type ServerArgs

type ServerArgs struct {
	HTTPAddr string // The listening address for http
	GRPCAddr string // The listening address for grpc

	HttpMasterAddr string        // Master's HTTP Address
	GrpcMasterAddr string        // Master's GRPC Address
	ReportInterval time.Duration // Heartbeat reporting interval
	ResultCapacity int
	Args           interface{}
}
var SrvArgs ServerArgs

func NewServerArgs

func NewServerArgs() *ServerArgs

type ServerBase

type ServerBase struct {
	Mode NodeType
	// contains filtered or unexported fields
}

func (*ServerBase) Initialize

func (s *ServerBase) Initialize(args *ServerArgs) error

type SlaveConn

type SlaveConn struct {
	PeerAddr string

	ConnID   string
	GrpcPort int
	Status   string
	// contains filtered or unexported fields
}

func GetSlaveConns added in v0.1.1

func GetSlaveConns() []*SlaveConn

type SlaveServer

type SlaveServer struct {
	ServerBase
	// contains filtered or unexported fields
}

func (*SlaveServer) ExecuteTask

func (*SlaveServer) HeartBeat

func (s *SlaveServer) HeartBeat(stream pb.SqueezeService_HeartBeatServer) error

func (*SlaveServer) Initialize

func (s *SlaveServer) Initialize(args *ServerArgs) error

func (*SlaveServer) Start

func (s *SlaveServer) Start(stopChan <-chan struct{}) error

type SlaveStream

type SlaveStream interface {
	Send(*pb.HeartBeatResponse) error
	Recv() (*pb.HeartBeatRequest, error)
	grpc.ServerStream
}

type WebServer

type WebServer struct {
	ServerBase
}

func (*WebServer) Initialize

func (s *WebServer) Initialize(args *ServerArgs) error

func (*WebServer) Start

func (s *WebServer) Start(stopChan <-chan struct{}) error

type Work

type Work struct {
	// Protocol constructor
	Builder build.ProtoBuilder

	// Request task to be executed
	Req *pb.ExecuteTaskRequest

	// Requests is the total number of requests to make.
	Requests int

	// Number of goroutines to run (Concurrent connections)
	Workers int

	Ctx    context.Context
	Cancel context.CancelFunc

	// RateLimit is the rate limit in queries per second.
	RateLimit float64

	// The capacity of the result of the collector channel
	ResultCapacity int
	// contains filtered or unexported fields
}

func (*Work) Finish

func (w *Work) Finish(start time.Duration) time.Duration

Finish waits for worker goroutines & collecotr goroutine to exit and return time spent on pressure measurement.

func (*Work) Run

func (w *Work) Run(ctx context.Context) (time.Duration, error)

Run starts collecotr & worker goroutine. It blocks until all work is done or receive cancel signal.

func (*Work) Stop

func (w *Work) Stop()

Stop will terminate all worker goroutines & collector groutine

Directories

Path Synopsis
web
api
dao
db

Jump to

Keyboard shortcuts

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