Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // The target number of teams to be created. NumTeams int64 `default:"2" validate:"range:[0,]"` // The target number of channels to be created. NumChannels int64 `default:"20" validate:"range:[0,]"` // The target number of posts to be created. NumPosts int64 `default:"1000" validate:"range:[0,]"` // The target number of reactions to be created. NumReactions int64 `default:"200" validate:"range:[0,]"` // The percentage of replies to be created. PercentReplies float64 `default:"0.5" validate:"range:[0,1]"` // The percentage of replies that should be in long threads PercentRepliesInLongThreads float64 `default:"0.05" validate:"range:[0,1]"` // The percentage of post that are marked as urgent PercentUrgentPosts float64 `default:"0.001" validate:"range:[0,1]"` // The percentage of public channels to be created. PercentPublicChannels float64 `default:"0.2" validate:"range:[0,1]"` // The percentage of private channels to be created. PercentPrivateChannels float64 `default:"0.1" validate:"range:[0,1]"` // The percentage of direct channels to be created. PercentDirectChannels float64 `default:"0.6" validate:"range:[0,1]"` // The percentage of group channels to be created. PercentGroupChannels float64 `default:"0.1" validate:"range:[0,1]"` }
Config holds information about the data to be generated by the GenController.
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 GenController ¶
type GenController struct {
// contains filtered or unexported fields
}
GenController is an implementation of a UserController used to generate realistic initial data.
func New ¶
func New(id int, user user.User, config *Config, status chan<- control.UserStatus) (*GenController, error)
New creates and initializes a new GenController 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 (*GenController) Run ¶
func (c *GenController) Run()
Run begins performing a set of actions in a loop with a defined wait in between the actions. 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 (*GenController) SetRate ¶
func (c *GenController) SetRate(rate float64) error
SetRate sets the relative speed of execution of actions by the user.