factory

package
v0.0.0-...-350adb2 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FactoryModeStatic   = "static"
	FactoryModeIncrease = "increase"
)

机器人的运行模式

Variables

This section is empty.

Functions

This section is empty.

Types

type Batch

type Batch struct {
	ID       string
	Name     string
	CurNum   int32
	TotalNum int32
	Errors   int32
	// contains filtered or unexported fields
}

func CreateBatch

func CreateBatch(scriptPath, name string, num int, tbyt []byte, bwg *utils.SizeWaitGroup, done chan interface{}) *Batch

func (*Batch) Close

func (b *Batch) Close()

func (*Batch) Info

func (b *Batch) Info() BatchInfo

func (*Batch) Report

func (b *Batch) Report() Report

type BatchInfo

type BatchInfo struct {
	ID     string
	Name   string
	Cur    int32
	Max    int32
	Errors int32
}

type Factory

type Factory struct {
	// contains filtered or unexported fields
}
var Global *Factory

func Create

func Create(opts ...Option) (*Factory, error)

func (*Factory) AddBehavior

func (f *Factory) AddBehavior(name string, byt []byte)

func (*Factory) AddTask

func (f *Factory) AddTask(name string, cnt int32) error

func (*Factory) AppendReport

func (f *Factory) AppendReport(rep Report)

func (*Factory) Close

func (f *Factory) Close()

Close 关闭机器人工厂

func (*Factory) CreateDebugBot

func (f *Factory) CreateDebugBot(name string, fbyt []byte) *bot.Bot

func (*Factory) CreateTask

func (f *Factory) CreateTask(name string, num int, bwg *utils.SizeWaitGroup) *Batch

func (*Factory) FindBehavior

func (f *Factory) FindBehavior(name string) (database.BehaviorInfo, error)

func (*Factory) FindBot

func (f *Factory) FindBot(botid string) *bot.Bot

func (*Factory) GetBatchInfo

func (f *Factory) GetBatchInfo() []BatchInfo

func (*Factory) GetBehaviors

func (f *Factory) GetBehaviors() []database.BehaviorInfo

func (*Factory) GetReport

func (f *Factory) GetReport() []Report

func (*Factory) RmvBehavior

func (f *Factory) RmvBehavior(name string)

func (*Factory) RmvBot

func (f *Factory) RmvBot(botid string)

type Option

type Option func(*Parm)

Option consul discover config wrapper

func WithReportLimit

func WithReportLimit(limit int) Option

func WithScriptPath

func WithScriptPath(path string) Option

type Parm

type Parm struct {

	// Interrupt 当card遇到err的时候是否中断整个程序 (默认为否
	Interrupt bool

	ScriptPath string

	ReportLimit int
	// contains filtered or unexported fields
}

Parm 机器人工厂可配置参数

type Report

type Report struct {
	ID     string
	Name   string
	BotNum int
	ReqNum int
	ErrNum int
	Tps    int
	Dura   string

	BeginTime time.Time

	UrlMap map[string]*urlDetail
}

type TaskInfo

type TaskInfo struct {
	Name string
	Num  int32
}

Jump to

Keyboard shortcuts

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