Documentation
¶
Overview ¶
Package botman provides a bot manager that ensures that designated Swarming bots are running, restarting them if necessary.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Botman ¶
type Botman struct {
// contains filtered or unexported fields
}
Botman manages running Swarming bots. Callers tell Botman what bots to add, drain, or terminate using an ID, and Botman makes sure there are bots running or not running for those IDs. IDs may refer to resources such as DUTs or some arbitrary index of bots to run.
func (*Botman) ActiveBots ¶
ActiveBots returns a slice of all Bots the controller is keeping alive. This includes Bots that are draining or terminated but not exited yet. This method is safe to call concurrently.
func (*Botman) AddBot ¶
AddBot adds a bot to the Botman. The controller ensures that an instance Swarming bot is running for the given resource ID. If the bot was already added or if the controller is blocked, do nothing. This method is concurrency safe.
func (*Botman) BlockBots ¶
func (b *Botman) BlockBots()
BlockBots marks the controller to not accept new Bots. This method is safe to call concurrently.
func (*Botman) DrainAll ¶
func (b *Botman) DrainAll()
DrainAll drains all Bots. You almost certainly want to call BlockBots first to make sure Bots don't get added right after calling this.
func (*Botman) DrainBot ¶
DrainBot removes an ID to no longer have bots running for it and drains its current bot. This method can be called repeatedly. If the controller does not have the ID, just call ReleaseResources on the controller's hook. This method is concurrency safe.
func (*Botman) TerminateAll ¶
func (b *Botman) TerminateAll()
TerminateAll terminates all Bots. You almost certainly want to call BlockBots first to make sure Bots don't get added right after calling this.
func (*Botman) TerminateBot ¶
TerminateBot removes an ID to no longer have bots running for it and terminates its current bot. This method can be called repeatedly. If the controller does not have the ID, just call ReleaseResources on the controller's hook. This method is concurrency safe.
type WorldHook ¶
type WorldHook interface { // StartBot starts a bot process for the given ID. // This method should be safe to call concurrently. StartBot(id string) (bot.Bot, error) // ReleaseResources is called to release resources for a bot process // that has finished. This method should be idempotent. ReleaseResources(id string) }
WorldHook defines the interface that a Botman uses to interact with the external world.