scarab

package module
v0.0.0-...-97e3eb8 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2021 License: Apache-2.0 Imports: 24 Imported by: 0

README

Not much to see

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCombined

func NewCombined(ctx context.Context, addr, uiAddr, serverAddr string, wrk Workload, user User)

func RunStandaloneWorker

func RunStandaloneWorker(profile, ver, desc string, args []*pb.ProfileArg, user User) error

func UIServer

func UIServer(addr string, uiSrvr pb.ManagerUIServer)

Types

type Manager

type Manager struct {
	pb.UnimplementedManagerServer
	pb.UnimplementedManagerUIServer
	// contains filtered or unexported fields
}

Manager implments the leaders service.

func NewManager

func NewManager() *Manager

func (*Manager) ListProfiles

func (s *Manager) ListProfiles(ctx context.Context, req *pb.ListProfilesRequest) (*pb.ListProfilesResponse, error)

func (*Manager) RegisterProfile

func (s *Manager) RegisterProfile(req *pb.RegisterProfileRequest, stream pb.Manager_RegisterProfileServer) error

func (*Manager) RunJob

func (*Manager) StartJob

func (s *Manager) StartJob(ctx context.Context, j *pb.StartJobRequest) (*pb.StartJobResponse, error)

StartJob implements the UI StartJob method.

func (*Manager) StopJob

func (s *Manager) StopJob(ctx context.Context, j *pb.StopJobRequest) (*pb.StopJobResponse, error)

type Profile

type Profile struct {
	FirstRegistration time.Time
	Spec              *pb.ProfileSpec
	Workers           map[ProfileRegistration]struct{}
}

func (*Profile) GetActiveWorkers

func (p *Profile) GetActiveWorkers() []*pb.WorkerDetails

type ProfileKey

type ProfileKey struct {
	Profile string
	Version string
}

type ProfileRegistration

type ProfileRegistration struct {
	ProfileKey
	ProfileWorker
}

type ProfileRegistry

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

func NewProfileRegistr

func NewProfileRegistr() *ProfileRegistry

func (*ProfileRegistry) ListProfiles

func (*ProfileRegistry) Register

func (*ProfileRegistry) Subscribe

func (pr *ProfileRegistry) Subscribe(profile, version string) ProfileSubscription

Subscrube subscribes to updates for the list of workers associated with a profile.

func (*ProfileRegistry) Unregister

func (pr *ProfileRegistry) Unregister(preg ProfileRegistration)

func (*ProfileRegistry) Unsubscribe

func (pr *ProfileRegistry) Unsubscribe(s ProfileSubscription)

Unsubscribe unsubscribes a given subscription, shut down the worker updates

type ProfileSubscription

type ProfileSubscription struct {
	Args []*pb.ProfileArg
	// contains filtered or unexported fields
}

func (*ProfileSubscription) ActiveWorkers

func (s *ProfileSubscription) ActiveWorkers() []*pb.WorkerDetails

func (*ProfileSubscription) Update

func (s *ProfileSubscription) Update(ctx context.Context) bool

type ProfileWorker

type ProfileWorker struct {
	*pb.WorkerDetails
	ID string
}

type Runner

type Runner interface {
	Run(args []*pb.JobArg)
}

type RunnerFunc

type RunnerFunc func(args []*pb.JobArg)

func (RunnerFunc) Run

func (f RunnerFunc) Run(args []*pb.JobArg)

type User

type User interface {
	Setup(reg prom.Registerer) Runner
}

type UserFunc

type UserFunc func(reg prom.Registerer) Runner

func (UserFunc) Setup

func (u UserFunc) Setup(reg prom.Registerer) Runner

type Worker

type Worker struct {
	pb.UnimplementedWorkerServer
	// contains filtered or unexported fields
}

func NewWorker

func NewWorker(ctx context.Context, addr, serverAddr string, wrk Workload, user User) (*Worker, error)

func (*Worker) Close

func (s *Worker) Close()

func (*Worker) ReportLoad

func (s *Worker) ReportLoad(req *pb.ReportLoadRequest, stream pb.Worker_ReportLoadServer) error

func (*Worker) RunProfile

func (s *Worker) RunProfile(stream pb.Worker_RunProfileServer) error

RunProfile runs the given profile synchronous and streams the results back to the caller. The number of running users can be updated, changes to all the other request arguments are ignored.

type Workload

type Workload struct {
	Spec *pb.ProfileSpec
}

Directories

Path Synopsis
cmd
example

Jump to

Keyboard shortcuts

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