Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // The minium amount of time (in milliseconds) the controlled users // will wait between actions. MinIdleTimeMs int `default:"1000" validate:"range:[0,]"` // The average amount of time (in milliseconds) the controlled users // will wait between actions. AvgIdleTimeMs int `default:"20000" validate:"range:($MinIdleTimeMs,]"` // The percentage of root posts that are marked as urgent PercentUrgentPosts float64 `default:"0.001" validate:"range:[0,1]"` // The percentage of all posts that are replies PercentReplies float64 `default:"0.18" validate:"range:[0,1]"` }
Config holds information needed to run a SimulController.
func ReadConfig ¶
ReadConfig reads the configuration file from the given string. If the string is empty, it will return a config with default values.
type SimulController ¶
type SimulController struct {
// contains filtered or unexported fields
}
SimulController is a simulative implementation of a UserController.
func New ¶
func New(id int, user user.User, config *Config, status chan<- control.UserStatus) (*SimulController, error)
New creates and initializes a new SimulController with given parameters. An id is provided to identify the controller, a User is passed as the entity to be controlled and a UserStatus channel is passed to communicate errors and information about the user's status.
func (*SimulController) InjectAction ¶ added in v1.10.0
func (c *SimulController) InjectAction(actionID string) error
InjectAction allows a named UserAction to be injected that is run once, at the next available opportunity. These actions can be injected via the coordinator via CLI or Rest API.
func (*SimulController) Run ¶
func (c *SimulController) Run()
Run begins performing a set of user actions in a loop. It keeps on doing it until Stop() is invoked. This is also a blocking function, so it is recommended to invoke it inside a goroutine.
func (*SimulController) SetRate ¶
func (c *SimulController) SetRate(rate float64) error
SetRate sets the relative speed of execution of actions by the user.