lbot

package
v0.0.0-...-7bbfb33 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

func Contains[T comparable](array []T, predicate func(T) bool) bool

func InStdInNotEmpty

func InStdInNotEmpty() (bool, error)

func NewConfig

func NewConfig(request *ConfigRequest) *config.Config

func NewConfigFromProtoConfigRequest

func NewConfigFromProtoConfigRequest(request *proto.ConfigRequest) *config.Config

func NewConfigResponseFromConfig

func NewConfigResponseFromConfig(cfg *config.Config) *proto.ConfigResponse

Types

type AgentRequest

type AgentRequest struct {
	Name                         string `json:"name,omitempty"`
	Port                         string `json:"port,omitempty"`
	MetricsExportUrl             string `json:"metrics_export_url,omitempty"`
	MetricsExportIntervalSeconds uint64 `json:"metrics_export_interval_seconds,omitempty"`
	MetricsExportPort            string `json:"metrics_export_port,omitempty"`
}

todo: change or even remove, yes, remove - there will be multiple agents, and agent will be configred from commandline todo: move agentn-name nad add new config flage - custom metrics label or similar purpose is to export metrics with cluster name

type ConfigRequest

type ConfigRequest struct {
	ConnectionString string           `json:"connection_string"`
	Agent            *AgentRequest    `json:"agent,omitempty"`
	Jobs             []*JobRequest    `json:"jobs,omitempty"`
	Schemas          []*SchemaRequest `json:"schemas,omitempty"`
	Debug            bool             `json:"debug,omitempty"`
}

todo: should be pointers

func ParseConfigFile

func ParseConfigFile(configFile string) (*ConfigRequest, error)

func ParseStdInConfig

func ParseStdInConfig() (*ConfigRequest, error)

func (*ConfigRequest) Validate

func (c *ConfigRequest) Validate() error

func (*ConfigRequest) Values

func (c *ConfigRequest) Values() (string, error)

type ConfigService

type ConfigService struct {
	proto.UnimplementedConfigServiceServer
	// contains filtered or unexported fields
}

func NewConfigService

func NewConfigService(ctx context.Context, lbot *Lbot) *ConfigService

func (*ConfigService) GetConfig

func (c *ConfigService) GetConfig(ctx context.Context, empty *emptypb.Empty) (*proto.ConfigResponse, error)

func (*ConfigService) SetConfig

func (c *ConfigService) SetConfig(ctx context.Context, request *proto.ConfigRequest) (*proto.ConfigResponse, error)

type JobRequest

type JobRequest struct {
	Name        string                 `json:"name,omitempty"`
	Database    string                 `json:"database,omitempty"`
	Collection  string                 `json:"collection,omitempty"`
	Type        string                 `json:"type,omitempty"`
	Schema      string                 `json:"schema,omitempty"`
	Connections uint64                 `json:"connections,omitempty"`
	Pace        uint64                 `json:"pace,omitempty"`
	DataSize    uint64                 `json:"data_size,omitempty"`
	BatchSize   uint64                 `json:"batch_size,omitempty"`
	Duration    time.Duration          `json:"duration,omitempty"`
	Operations  uint64                 `json:"operations,omitempty"`
	Timeout     time.Duration          `json:"timeout,omitempty"`
	Filter      map[string]interface{} `json:"filter,omitempty"`
}

func (*JobRequest) UnmarshalJSON

func (c *JobRequest) UnmarshalJSON(data []byte) (err error)

func (*JobRequest) Validate

func (job *JobRequest) Validate() error

type Lbot

type Lbot struct {
	Config *config.Config
	// contains filtered or unexported fields
}

func NewLbot

func NewLbot(ctx context.Context, cfg *config.Config) (*Lbot, error)

func (*Lbot) AgentHeartBeat

func (l *Lbot) AgentHeartBeat(id primitive.ObjectID, name string) error

func (*Lbot) AreWorkloadsFinished

func (l *Lbot) AreWorkloadsFinished(command *database.Command) (bool, error)

func (*Lbot) Cancel

func (l *Lbot) Cancel() error

func (*Lbot) Client

func (l *Lbot) Client() (err error)

func (*Lbot) Close

func (l *Lbot) Close() (err error)

func (*Lbot) GenerateWorkload

func (l *Lbot) GenerateWorkload(command *database.Command) ([]*database.Workload, error)

func (*Lbot) GetNextUnFinishedCommand

func (l *Lbot) GetNextUnFinishedCommand() (*database.Command, error)

func (*Lbot) HandleCommand

func (l *Lbot) HandleCommand()

func (*Lbot) HandleWorkload

func (l *Lbot) HandleWorkload()

func (*Lbot) InitAgent

func (l *Lbot) InitAgent(id primitive.ObjectID, name string) error

func (*Lbot) IsMasterAgent

func (l *Lbot) IsMasterAgent(agentId primitive.ObjectID) (bool, error)

func (*Lbot) Run

func (l *Lbot) Run() (err error)

func (*Lbot) SaveWorkloads

func (l *Lbot) SaveWorkloads(ws []*database.Workload) error

func (*Lbot) SetCommandState

func (l *Lbot) SetCommandState(command *database.Command, state database.CommandState) error

func (*Lbot) SetConfig

func (l *Lbot) SetConfig(config *config.Config)

func (*Lbot) SetWorkloadState

func (l *Lbot) SetWorkloadState(workload *database.Workload, state database.WorkloadState) error

func (*Lbot) StartWorkload

func (l *Lbot) StartWorkload(workload *database.Workload)

func (*Lbot) UpdateRunningAgents

func (l *Lbot) UpdateRunningAgents() error

depricated, to be removed

type Orchiestrator

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

func NewOrchiestrator

func NewOrchiestrator(ctx context.Context) *Orchiestrator

func (*Orchiestrator) Install

func (*Orchiestrator) List

func (*Orchiestrator) UnInstall

func (*Orchiestrator) Upgrade

type ProgressProcess

type ProgressProcess struct {
	proto.UnimplementedProgressProcessServer
	// contains filtered or unexported fields
}

func NewProgressProcess

func NewProgressProcess(ctx context.Context, lbot *Lbot) *ProgressProcess

func (*ProgressProcess) Run

type SchemaRequest

type SchemaRequest struct {
	Name       string                 `json:"name,omitempty"`
	Database   string                 `json:"database,omitempty"`
	Collection string                 `json:"collection,omitempty"`
	Schema     map[string]interface{} `json:"schema,omitempty"` // todo: introducte new type and parse
	Save       []string               `json:"save,omitempty"`
}

type StartProcess

type StartProcess struct {
	proto.UnimplementedStartProcessServer
	// contains filtered or unexported fields
}

func NewStartProcess

func NewStartProcess(ctx context.Context, lbot *Lbot) *StartProcess

func (*StartProcess) Run

func (*StartProcess) RunWithProgress

type StoppingProcess

type StoppingProcess struct {
	proto.UnimplementedStopProcessServer
	// contains filtered or unexported fields
}

func NewStoppingProcess

func NewStoppingProcess(ctx context.Context, lbot *Lbot) *StoppingProcess

func (*StoppingProcess) Run

type WatchingProcess

type WatchingProcess struct {
	proto.UnimplementedWatchProcessServer
	// contains filtered or unexported fields
}

func NewWatchingProcess

func NewWatchingProcess(ctx context.Context, lbot *Lbot) *WatchingProcess

func (*WatchingProcess) Run

type WatchingRequest

type WatchingRequest struct{}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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