sim

package
v2.4.4+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2020 License: MIT Imports: 30 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSchema added in v1.0.1

func GetSchema(c *mongo.Collection, verbose bool) (string, error)

GetSchema returns a masked first doc of a collection

Types

type Feeder

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

Feeder seeds feeder

func NewFeeder

func NewFeeder() *Feeder

NewFeeder establish seeding parameters

func (*Feeder) SeedAllDemoData

func (f *Feeder) SeedAllDemoData(client *mongo.Client) error

SeedAllDemoData - seed data for demo

 models: {
   "_id": string
  "name": string,
  "description": string
  "year": integer
}
robots: {
  "_id": string
  "modelId": string
  "notes": string,
  "batteryPct": float,
  "tasks": [{"for": string, "minutesUsed": integer}]
}

func (*Feeder) SeedCars

func (f *Feeder) SeedCars(client *mongo.Client) error

SeedCars seeds cars collection

func (*Feeder) SeedData

func (f *Feeder) SeedData(client *mongo.Client) error

SeedData seeds all demo data

func (*Feeder) SeedFavorites

func (f *Feeder) SeedFavorites(client *mongo.Client) error

SeedFavorites seeds demo data of collection favorites

func (*Feeder) SetCollection

func (f *Feeder) SetCollection(collection string)

SetCollection set collection

func (*Feeder) SetDatabase

func (f *Feeder) SetDatabase(database string)

SetDatabase set database

func (*Feeder) SetFile

func (f *Feeder) SetFile(file string)

SetFile set file

func (*Feeder) SetIsDrop

func (f *Feeder) SetIsDrop(isDrop bool)

SetIsDrop set isDrop

func (*Feeder) SetNumberConnections added in v1.0.1

func (f *Feeder) SetNumberConnections(conns int)

SetNumberConnections set conns

func (*Feeder) SetShowProgress

func (f *Feeder) SetShowProgress(showProgress bool)

SetShowProgress set showProgress

func (*Feeder) SetTotal

func (f *Feeder) SetTotal(total int)

SetTotal set total

type Frequency added in v1.0.1

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

Frequency stores wait time

type Model

type Model struct {
	ID          string `json:"_id" bson:"_id"`
	Name        string
	Description string
	Year        int
}

Model - robot model

type Robot

type Robot struct {
	ID         string  `json:"_id" bson:"_id"`
	ModelID    string  `json:"modelId,omitempty" bson:"modelId,omitempty"`
	Notes      string  `json:"notes" bson:"notes"`
	BatteryPct float32 `json:"batteryPct,omitempty" bson:"batteryPct,omitempty"`
	Tasks      []Task  `json:"tasks" bson:"tasks"`
}

Robot -

type Runner

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

Runner -

func NewRunner

func NewRunner(connString connstring.ConnString) (*Runner, error)

NewRunner - Constructor

func (*Runner) Cleanup

func (rn *Runner) Cleanup() error

Cleanup drops the temp database

func (*Runner) CollectAllStatus added in v1.0.1

func (rn *Runner) CollectAllStatus() error

CollectAllStatus collects all server stats

func (*Runner) PopulateData added in v1.0.1

func (rn *Runner) PopulateData() error

PopulateData - Insert docs to evaluate performance/bandwidth

{
	favorites: {
		sports: []
		cities: []
	}
	favoriteSports: []
	favoriteSports1
	favoriteSports2
	favoriteSports3
}

func (*Runner) SetAutoMode added in v1.0.1

func (rn *Runner) SetAutoMode(auto bool)

SetAutoMode set transaction per second

func (*Runner) SetCollection added in v1.0.1

func (rn *Runner) SetCollection(collectionName string)

SetCollection set collection name

func (*Runner) SetDropFirstMode

func (rn *Runner) SetDropFirstMode(mode bool)

SetDropFirstMode -

func (*Runner) SetNumberConnections

func (rn *Runner) SetNumberConnections(num int)

SetNumberConnections -

func (*Runner) SetPeekingMode added in v1.0.1

func (rn *Runner) SetPeekingMode(mode bool)

SetPeekingMode -

func (*Runner) SetSimOnlyMode

func (rn *Runner) SetSimOnlyMode(mode bool)

SetSimOnlyMode -

func (*Runner) SetSimulationDuration

func (rn *Runner) SetSimulationDuration(duration int)

SetSimulationDuration -

func (*Runner) SetTPS

func (rn *Runner) SetTPS(tps int)

SetTPS set transaction per second

func (*Runner) SetTemplateFilename

func (rn *Runner) SetTemplateFilename(filename string)

SetTemplateFilename -

func (*Runner) SetTransactionTemplateFilename

func (rn *Runner) SetTransactionTemplateFilename(filename string)

SetTransactionTemplateFilename -

func (*Runner) SetVerbose

func (rn *Runner) SetVerbose(verbose bool)

SetVerbose -

func (*Runner) Simulate

func (rn *Runner) Simulate(duration int, transactions []Transaction, thread int) error

Simulate simulates CRUD for load tests

func (*Runner) Start

func (rn *Runner) Start() error

Start process requests

type ServerStats added in v1.0.1

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

ServerStats stores server stats struct

func NewServerStats added in v1.0.1

func NewServerStats(uri string, channel chan string) *ServerStats

NewServerStats gets server status

func (*ServerStats) SetPeekingMode added in v1.0.1

func (st *ServerStats) SetPeekingMode(peek bool)

SetPeekingMode sets peeking mode

func (*ServerStats) SetVerbose added in v1.0.1

func (st *ServerStats) SetVerbose(verbose bool)

SetVerbose sets verbose

type Task

type Task struct {
	For         string `json:"for" bson:"for"`
	MinutesUsed int    `json:"minutesUsed" bson:"minutesUsed"`
}

Task - robot task

type Transaction

type Transaction struct {
	C      string   `json:"c"`
	Filter bson.M   `json:"filter"`
	Op     bson.M   `json:"op"`
	Pipe   []bson.M `json:"pipe"`
}

Transaction -

type TransactionDoc

type TransactionDoc struct {
	Transactions []Transaction `json:"transactions" bson:"transactions"`
	Indexes      []bson.M      `json:"indexes" bson:"indexes"`
}

TransactionDoc -

func GetTransactions

func GetTransactions(filename string) TransactionDoc

GetTransactions -

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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