config

package
v0.0.0-...-f66a8c4 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FlagLogLevel  = "log-level"
	FlagLogFormat = "log-format"
)
View Source
const (
	AgentsHeartbeatInterval   = time.Second * 2
	AgentsHeartbeatExpiration = -time.Second * 4
)
View Source
const (
	DB                    = "admin"
	CommandCollection     = "lbotCmd"
	WorkloadCollection    = "lbotWorkload"
	ConfigCollection      = "lbotConfig"
	AgentStatusCollection = "lbotAgent"
)

Variables

This section is empty.

Functions

func Contains

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

Types

type Agent

type Agent 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"`
}

type Config

type Config struct {
	ConnectionString string    `json:"connection_string"`
	Agent            *Agent    `json:"agent,omitempty"`
	Jobs             []*Job    `json:"jobs,omitempty"`
	Schemas          []*Schema `json:"schemas,omitempty"`
	Debug            bool      `json:"debug,omitempty"`
}

func (*Config) GetSchema

func (c *Config) GetSchema(name string) *Schema

func (*Config) Validate

func (c *Config) Validate() error

type Duration

type Duration struct {
	time.Duration
}

func (Duration) MarshalJSON

func (d Duration) MarshalJSON() ([]byte, error)

func (*Duration) UnmarshalJSON

func (d *Duration) UnmarshalJSON(b []byte) error

type Job

type Job 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"` // Maximum number of concurrent connections
	Pace        uint64                 `json:"pace,omitempty"`        // rps limit / peace - if not set max
	DataSize    uint64                 `json:"data_size,omitempty"`   // data size in bytes
	BatchSize   uint64                 `json:"batch_size,omitempty"`
	Duration    time.Duration          `json:"duration,omitempty"`
	Operations  uint64                 `json:"operations,omitempty"`
	Timeout     time.Duration          `json:"timeout,omitempty"` // if not set, default
	Filter      map[string]interface{} `json:"filter,omitempty"`
}

func (*Job) UnmarshalJSON

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

func (*Job) Validate

func (job *Job) Validate() error

type JobType

type JobType string
const (
	Write          JobType = "write"
	BulkWrite      JobType = "bulk_write"
	Read           JobType = "read"
	Update         JobType = "update"
	Sleep          JobType = "sleep"
	DropCollection JobType = "drop_collection"
)

type Schema

type Schema 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"`
}

Jump to

Keyboard shortcuts

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