worker

package
v0.2.23 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2019 License: AGPL-3.0 Imports: 8 Imported by: 2

Documentation

Overview

Package worker provides the actual running of games. It is the core of the engine and game logic. It interacts primarily with the controller API writing and reading game state.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Runner

func Runner(ctx context.Context, client pb.ControllerClient, id string) error

Runner will run an invidual game to completion. It takes a game id and a connection to the controller as arguments.

Types

type Worker

type Worker struct {
	ControllerClient pb.ControllerClient
	PollInterval     time.Duration
	RunGame          func(context.Context, pb.ControllerClient, string) error
}

Worker is the worker interface. It wraps a main Perform functions which is where all of the game logic should live.

func (*Worker) Run

func (w *Worker) Run(ctx context.Context, workerID int)

Run will run the worker in a loop.

Jump to

Keyboard shortcuts

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