Documentation
¶
Index ¶
- type BotConfigEnablesProvider
- type BotInfo
- type Botter
- func (b *Botter) Add(botID string) error
- func (b *Botter) BotInfo(id string) (BotInfo, error)
- func (b *Botter) Bots() ([]string, error)
- func (b *Botter) Capacity() uint32
- func (b *Botter) Remove(botID string) error
- func (b *Botter) Run(ctx context.Context) error
- func (b *Botter) Status() (StatusResponse, error)
- type BotterFactory
- type BotterIF
- type BotterPool
- func (p *BotterPool) AddBot(botID string) error
- func (p *BotterPool) AddBotter(address string)
- func (p *BotterPool) BotInfo(botID string) (BotInfo, error)
- func (p *BotterPool) GetBotter(address string) BotterIF
- func (p *BotterPool) RemoveAllBots()
- func (p *BotterPool) RemoveAllBotters()
- func (p *BotterPool) RemoveBot(botID string) error
- func (p *BotterPool) RemoveBotter(address string)
- func (p *BotterPool) Run(ctx context.Context) (err error)
- type PluginInfo
- type StatusResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BotConfigEnablesProvider ¶
type BotConfigEnablesProvider interface {
GetAllEnabledBotIDs() []string
}
type BotInfo ¶
type BotInfo struct { BotID string `json:"botId"` Platform string `json:"platform"` Healthy bool `json:"healthy"` Plugins []PluginInfo `json:"plugins"` }
BotInfo contains all information of a bot running on a Botter instance.
type Botter ¶
type Botter struct {
// contains filtered or unexported fields
}
Botter represents a Botter instance and provides management functions like the possibility to spawn or remove bots or get the running Bots.
func NewBotter ¶
NewBotter creates a new Botter management instance for the Botter at the given address of the form host:port Currently the capacity of a Botter is by default 10 TODO: Get capacity dynamically from the managed BotterInstance
func (*Botter) BotInfo ¶
BotInfo returns configuration and health state of a bot identified by its ID.
func (*Botter) Status ¶
func (b *Botter) Status() (StatusResponse, error)
Status of the Botter instance.
type BotterFactory ¶
type BotterFactory struct{}
BotterFactory creates new Botter instances.
func (*BotterFactory) CreateBotter ¶
func (b *BotterFactory) CreateBotter(address string) BotterIF
CreateBotter returns a new Botter instance for the given address.
type BotterIF ¶
type BotterIF interface { // Run the Botter (blocking) Run(ctx context.Context) error Add(botID string) error Remove(botID string) error Bots() ([]string, error) BotInfo(id string) (BotInfo, error) Capacity() uint32 }
BotterIF describes the functionality of a Botter to use in the BotterPool.
type BotterPool ¶
type BotterPool struct {
// contains filtered or unexported fields
}
BotterPool holds various instances of Botters and can deploy new bots to them.
func NewBotterPool ¶
func NewBotterPool(factory factory, bottersConfig map[string]config.Botter, enabledBots BotConfigEnablesProvider) *BotterPool
NewBotterPool returns a new BotterPool instance.
func (*BotterPool) AddBot ¶
func (p *BotterPool) AddBot(botID string) error
AddBot adds a bot to the next free Botter instance. Returns an error if something goes wrong.
func (*BotterPool) AddBotter ¶
func (p *BotterPool) AddBotter(address string)
AddBotter a new Botter to the pool. Idempotent.
func (*BotterPool) BotInfo ¶
func (p *BotterPool) BotInfo(botID string) (BotInfo, error)
BotInfo returns information of a running bot. Automatically determines the Botter instance the bot is running on. Returns an error if something goes wrong.
func (*BotterPool) GetBotter ¶
func (p *BotterPool) GetBotter(address string) BotterIF
GetBotter returns a reference to the requested botter or nil if it does not exist.
func (*BotterPool) RemoveAllBots ¶
func (p *BotterPool) RemoveAllBots()
RemoveAllBots removes all bots from all Botter instances. Idempotent.
func (*BotterPool) RemoveAllBotters ¶
func (p *BotterPool) RemoveAllBotters()
RemoveAllBotters removes all Botters from the pool. Idempotent
func (*BotterPool) RemoveBot ¶
func (p *BotterPool) RemoveBot(botID string) error
RemoveBot removes a bot. Idempotent. Automatically determines the Botter instance the bot is running on. Returns an error if something goes wrong.
func (*BotterPool) RemoveBotter ¶
func (p *BotterPool) RemoveBotter(address string)
RemoveBotter removes a Botter with a certain address from the pool. Idempotent.
type PluginInfo ¶
PluginInfo contains info about one plugin
type StatusResponse ¶
StatusResponse contains all the information of a Status call.