This section is empty.


This section is empty.


This section is empty.


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

      func NewBotter(httpClient httpClient, address string) *Botter

        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) Add

        func (b *Botter) Add(botID string) error

          Add a new bot to the Botter instance. Idempotent.

          func (*Botter) BotInfo

          func (b *Botter) BotInfo(id string) (BotInfo, error)

            BotInfo returns configuration and health state of a bot identified by its ID.

            func (*Botter) Bots

            func (b *Botter) Bots() ([]string, error)

              Bots returns the IDs of all the running bots.

              func (*Botter) Capacity

              func (b *Botter) Capacity() uint32

                Capacity of the Botter instance

                func (*Botter) Remove

                func (b *Botter) Remove(botID string) error

                  Remove a bot from the Botter instance. Idempotent.

                  func (*Botter) Run

                  func (b *Botter) Run(ctx context.Context) error

                    Run the Botter (blocking)

                    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.

                                                func (*BotterPool) Run

                                                func (p *BotterPool) Run(ctx context.Context) (err error)

                                                  Run the BotterPool. If a new bot is added to the pool, it will be automatically started.

                                                  type PluginInfo

                                                  type PluginInfo struct {
                                                  	Plugin string `json:"plugin"`
                                                  	Active bool   `json:"active"`

                                                    PluginInfo contains info about one plugin

                                                    type StatusResponse

                                                    type StatusResponse struct {
                                                    	Status  string `json:"status"`
                                                    	Version string `json:"version"`

                                                      StatusResponse contains all the information of a Status call.